diff liboctave/Sparse.cc @ 7717:ff918ee1a983

Delete idx in Sparse<T> and Array<T> operator =
author David Bateman <dbateman@free.fr>
date Wed, 16 Apr 2008 23:33:36 +0200
parents 36594d5bbe13
children 283989f2da9b
line wrap: on
line diff
--- a/liboctave/Sparse.cc
+++ b/liboctave/Sparse.cc
@@ -615,6 +615,28 @@
 }
 
 template <class T>
+Sparse<T>&
+Sparse<T>::operator = (const Sparse<T>& a)
+{
+  if (this != &a)
+    {
+      if (--rep->count <= 0)
+	delete rep;
+
+      rep = a.rep;
+      rep->count++;
+
+      dimensions = a.dimensions;
+
+      delete [] idx;
+      idx_count = 0;
+      idx = 0;
+    }
+
+  return *this;
+}
+
+template <class T>
 octave_idx_type
 Sparse<T>::compute_index (const Array<octave_idx_type>& ra_idx) const
 {