comparison src/ov-struct.cc @ 10749:df1a3e0ebbff

important fixes for struct rewrite(1)
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 24 Jun 2010 12:43:35 +0200
parents 58c1b5402588
children 717ba2c3eef1
comparison
equal deleted inserted replaced
10748:d699a6c63263 10749:df1a3e0ebbff
429 429
430 if (didx.numel () == tmp_cell.numel ()) 430 if (didx.numel () == tmp_cell.numel ())
431 tmp_cell = tmp_cell.reshape (didx); 431 tmp_cell = tmp_cell.reshape (didx);
432 432
433 433
434 map.contents (key).assign (idxf, tmp_cell); 434 map.assign (idxf, key, tmp_cell);
435 435
436 if (! error_state) 436 if (! error_state)
437 { 437 {
438 count++; 438 count++;
439 retval = octave_value (this); 439 retval = octave_value (this);
446 const octave_map& cmap = const_cast<const octave_map &> (map); 446 const octave_map& cmap = const_cast<const octave_map &> (map);
447 // cast map to const reference to avoid forced key insertion. 447 // cast map to const reference to avoid forced key insertion.
448 if (idxf.all_scalars () 448 if (idxf.all_scalars ()
449 || cmap.contents (key).index (idxf, true).numel () == 1) 449 || cmap.contents (key).index (idxf, true).numel () == 1)
450 { 450 {
451 map.contents (key).assign (idxf, Cell (t_rhs.storable_value ())); 451 map.assign (idxf, key, Cell (t_rhs.storable_value ()));
452 if (! error_state) 452 if (! error_state)
453 { 453 {
454 count++; 454 count++;
455 retval = octave_value (this); 455 retval = octave_value (this);
456 } 456 }
1237 1237
1238 if (! error_state) 1238 if (! error_state)
1239 map.setfield (key, t_rhs.storable_value ()); 1239 map.setfield (key, t_rhs.storable_value ());
1240 else 1240 else
1241 gripe_failed_assignment (); 1241 gripe_failed_assignment ();
1242
1243 count++;
1244 retval = this;
1242 } 1245 }
1243 else 1246 else
1244 { 1247 {
1245 // Forward this case to octave_struct. 1248 // Forward this case to octave_struct.
1246 octave_value tmp (new octave_struct (octave_map (map))); 1249 octave_value tmp (new octave_struct (octave_map (map)));