diff src/ov-scalar.h @ 4749:a4bc7156bd60

[project @ 2004-02-07 16:59:28 by jwe]
author jwe
date Sat, 07 Feb 2004 16:59:28 +0000
parents 34a740dc31a6
children c638c144d4da
line wrap: on
line diff
--- a/src/ov-scalar.h	Sat Feb 07 06:27:28 2004 +0000
+++ b/src/ov-scalar.h	Sat Feb 07 16:59:28 2004 +0000
@@ -39,6 +39,7 @@
 #include "str-vec.h"
 
 #include "ov-base.h"
+#include "ov-re-mat.h"
 #include "ov-base-scalar.h"
 #include "ov-typeinfo.h"
 
@@ -66,7 +67,11 @@
   ~octave_scalar (void) { }
 
   octave_value *clone (void) const { return new octave_scalar (*this); }
-  octave_value *empty_clone (void) const { return new octave_scalar (); }
+
+  // We return an octave_matrix here instead of an octave_scalar so
+  // that in expressions like A(2,2,2) = 2 (for A previously
+  // undefined), A will be empty instead of a 1x1 object.
+  octave_value *empty_clone (void) const { return new octave_matrix (); }
 
   octave_value do_index_op (const octave_value_list& idx, int resize_ok);