Mercurial > octave
diff libinterp/octave-value/ov-struct.cc @ 23880:1b232c0c19e6
Empty indexing of a struct should return the entire struct (bug #51633).
* ov-struct.cc (do_index_op): Check size of idx list. If it is zero, return
the struct itself, otherwise continue and perform indexing operation.
* test/struct.tst: Add test for proper behavior.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 11 Aug 2017 08:05:01 -0700 |
parents | 336f89b6208b |
children | 194eb4bd202b |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-struct.cc Thu Aug 10 21:17:09 2017 -0700 +++ b/libinterp/octave-value/ov-struct.cc Fri Aug 11 08:05:01 2017 -0700 @@ -537,8 +537,10 @@ octave_value octave_struct::do_index_op (const octave_value_list& idx, bool resize_ok) { - // octave_map handles indexing itself. - return map.index (idx, resize_ok); + if (idx.length () == 0) + return map; + else // octave_map handles indexing itself. + return map.index (idx, resize_ok); } size_t