diff src/ov-struct.cc @ 8031:d9987dbdf91b

octave_struct::subsref: don't resize for simple x(idx) case
author John W. Eaton <jwe@octave.org>
date Tue, 12 Aug 2008 13:20:27 -0400
parents 443a8f5a50fd
children 283989f2da9b
line wrap: on
line diff
--- a/src/ov-struct.cc	Tue Aug 12 11:02:35 2008 -0400
+++ b/src/ov-struct.cc	Tue Aug 12 13:20:27 2008 -0400
@@ -129,7 +129,7 @@
 	      }
 	  }
 	else
-	  retval(0) = map.index (idx.front (), true);
+	  retval(0) = map.index (idx.front (), false);
       }
       break;
 
@@ -162,6 +162,14 @@
   return retval;
 }
 
+/*
+%!test
+%! x(1).a.a = 1; x(2).a.a = 2;
+%! assert (size (x), [1, 2]);
+%! assert (x(1).a.a, 1);
+%! assert (x(2).a.a, 2);
+*/
+
 octave_value
 octave_struct::numeric_conv (const Cell& val,
 			     const std::string& type)