# HG changeset patch # User Jaroslav Hajek # Date 1222980644 -7200 # Node ID 977d5204cf67e5cd19c911023fac707f8d972a33 # Parent ea9b5f31bfac5167cf87a6a4a784deb21f0e1209 fix null assignment for structs diff --git a/src/Cell.cc b/src/Cell.cc --- a/src/Cell.cc +++ b/src/Cell.cc @@ -172,6 +172,19 @@ return *this; } +Cell& +Cell::delete_elements (const octave_value_list& idx_arg) + +{ + Array ra_idx (idx_arg.length ()); + for (octave_idx_type i = 0; i < idx_arg.length (); i++) + ra_idx.xelem (i) = idx_arg(i).index_vector (); + + maybe_delete_elements (ra_idx, octave_value ()); + + return *this; +} + octave_idx_type Cell::nnz (void) const { diff --git a/src/Cell.h b/src/Cell.h --- a/src/Cell.h +++ b/src/Cell.h @@ -89,6 +89,8 @@ const octave_value& rfv = resize_fill_value ()) const { return Cell (ArrayN::index (ra_idx, resize_ok, rfv)); } + Cell& delete_elements (const octave_value_list& idx); + Cell& assign (const octave_value_list& idx, const Cell& rhs, const octave_value& fill_val = octave_value ()); diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2008-10-02 Jaroslav Hajek + + * Cell.h (Cell::delete_elements): Declare new member function. + * Cell.h (Cell::delete_elements): Define it. + * oct-map.cc (Octave_map::maybe_delete_elements): Call delete_elements + instead of assign with empty Cell. + 2008-10-02 John W. Eaton * pt-arg-list.cc (tree_argument_list::convert_to_const_vector): diff --git a/src/oct-map.cc b/src/oct-map.cc --- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -290,7 +290,7 @@ { std::string k = t_keys[i]; - map[k] = contents(k).assign (idx, Cell()); + map[k] = contents(k).delete_elements (idx); if (error_state) break;