diff liboctave/Array.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 ad16ea379d2f
children 82be108cc558
line wrap: on
line diff
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -63,6 +63,28 @@
 }
 
 template <class T>
+Array<T>&
+Array<T>::operator = (const Array<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>
 Array<T>
 Array<T>::squeeze (void) const
 {