Mercurial > hg > octave-lyh
comparison src/oct-map.cc @ 11055:b721e12140cc
fix off-by-1 error in octave_scalar_map
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 29 Sep 2010 22:08:34 +0200 |
parents | f42e8c6196c3 |
children | b0eec300d3fc |
comparison
equal
deleted
inserted
replaced
11054:3b8817c91e31 | 11055:b721e12140cc |
---|---|
236 octave_value& | 236 octave_value& |
237 octave_scalar_map::contents (const std::string& k) | 237 octave_scalar_map::contents (const std::string& k) |
238 { | 238 { |
239 octave_idx_type idx = xkeys.getfield (k); | 239 octave_idx_type idx = xkeys.getfield (k); |
240 if (idx >= static_cast<octave_idx_type> (xvals.size ())) | 240 if (idx >= static_cast<octave_idx_type> (xvals.size ())) |
241 xvals.resize (idx); | 241 xvals.resize (idx+1); |
242 return xvals[idx]; | 242 return xvals[idx]; |
243 } | 243 } |
244 | 244 |
245 octave_map::octave_map (const octave_scalar_map& m) | 245 octave_map::octave_map (const octave_scalar_map& m) |
246 : xkeys (m.xkeys), xvals (), dimensions (1, 1) | 246 : xkeys (m.xkeys), xvals (), dimensions (1, 1) |