changeset 11804:7a92d9b3e7d0 release-3-0-x

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 daf91931b32b
children 7eb3794f072a
files src/ChangeLog src/ov-struct.cc
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-12  John W. Eaton  <jwe@octave.org>
+
+	* ov-struct.cc (octave_struct::subsref): Don't allow resizing for
+	simple x(idx) case.
+
 2008-08-08  Tatsuro MATSUOKA  <tmacchant@yahoo.co.jp>
 
 	* A patch fntests for rand.cc for octave for windows (cygwin, mingw ,msvc)
--- a/src/ov-struct.cc
+++ b/src/ov-struct.cc
@@ -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)