Mercurial > hg > octave-max
comparison src/ov-struct.cc @ 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 | 72830070a17b |
children |
comparison
equal
deleted
inserted
replaced
11803:daf91931b32b | 11804:7a92d9b3e7d0 |
---|---|
127 | 127 |
128 skip++; | 128 skip++; |
129 } | 129 } |
130 } | 130 } |
131 else | 131 else |
132 retval(0) = map.index (idx.front (), true); | 132 retval(0) = map.index (idx.front (), false); |
133 } | 133 } |
134 break; | 134 break; |
135 | 135 |
136 case '.': | 136 case '.': |
137 { | 137 { |
159 if (idx.size () > 1) | 159 if (idx.size () > 1) |
160 retval = retval(0).next_subsref (nargout, type, idx, skip); | 160 retval = retval(0).next_subsref (nargout, type, idx, skip); |
161 | 161 |
162 return retval; | 162 return retval; |
163 } | 163 } |
164 | |
165 /* | |
166 %!test | |
167 %! x(1).a.a = 1; x(2).a.a = 2; | |
168 %! assert (size (x), [1, 2]); | |
169 %! assert (x(1).a.a, 1); | |
170 %! assert (x(2).a.a, 2); | |
171 */ | |
164 | 172 |
165 octave_value | 173 octave_value |
166 octave_struct::numeric_conv (const Cell& val, | 174 octave_struct::numeric_conv (const Cell& val, |
167 const std::string& type) | 175 const std::string& type) |
168 { | 176 { |