changeset 12619:3b2e005e4219 stable

Return octave_value of the same class as the original. * ov-class.h (octave_value reshape (const dim_vector&) const, octave_value resize (const dim_vector&, bool) const) : Return octave_value of the same class as the original.
author David Bateman <dbateman@free.fr>
date Mon, 18 Apr 2011 17:29:17 -0700
parents 16cca721117b
children 6f3f18957851
files src/ov-class.h
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ov-class.h	Sun Apr 17 19:57:07 2011 -0700
+++ b/src/ov-class.h	Mon Apr 18 17:29:17 2011 -0700
@@ -127,10 +127,18 @@
   size_t nparents (void) const { return parent_list.size (); }
 
   octave_value reshape (const dim_vector& new_dims) const
-    { return map.reshape (new_dims); }
+    { 
+      octave_class retval = octave_class (*this);
+      retval.map = retval.map_value().reshape (new_dims);
+      return octave_value (new octave_class (retval));
+    }
 
   octave_value resize (const dim_vector& dv, bool = false) const
-    { octave_map tmap = map; tmap.resize (dv); return tmap; }
+    { 
+      octave_class retval = octave_class (*this);
+      retval.map.resize (dv);
+      return octave_value (new octave_class (retval));
+    }
 
   bool is_defined (void) const { return true; }