comparison src/ov-scalar.cc @ 8437:f00578b495e9

remove valid_as_scalar_index
author Jaroslav Hajek <highegg@gmail.com>
date Sat, 27 Dec 2008 17:01:52 +0100
parents c777f3ce02d8
children eb63fbe60fab
comparison
equal deleted inserted replaced
8436:342f72c1df1a 8437:f00578b495e9
73 } 73 }
74 74
75 octave_value 75 octave_value
76 octave_scalar::do_index_op (const octave_value_list& idx, bool resize_ok) 76 octave_scalar::do_index_op (const octave_value_list& idx, bool resize_ok)
77 { 77 {
78 octave_value retval; 78 // FIXME -- this doesn't solve the problem of
79 79 //
80 if (idx.valid_scalar_indices ()) 80 // a = 1; a([1,1], [1,1], [1,1])
81 retval = scalar; 81 //
82 else 82 // and similar constructions. Hmm...
83 { 83
84 // FIXME -- this doesn't solve the problem of 84 // FIXME -- using this constructor avoids narrowing the
85 // 85 // 1x1 matrix back to a scalar value. Need a better solution
86 // a = 1; a([1,1], [1,1], [1,1]) 86 // to this problem.
87 // 87
88 // and similar constructions. Hmm... 88 octave_value tmp (new octave_matrix (matrix_value ()));
89 89
90 // FIXME -- using this constructor avoids narrowing the 90 return tmp.do_index_op (idx, resize_ok);
91 // 1x1 matrix back to a scalar value. Need a better solution
92 // to this problem.
93
94 octave_value tmp (new octave_matrix (matrix_value ()));
95
96 retval = tmp.do_index_op (idx, resize_ok);
97 }
98
99 return retval;
100 } 91 }
101 92
102 octave_value 93 octave_value
103 octave_scalar::resize (const dim_vector& dv, bool fill) const 94 octave_scalar::resize (const dim_vector& dv, bool fill) const
104 { 95 {