Mercurial > hg > octave-nkf
diff src/ov-struct.cc @ 7651:443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 26 Mar 2008 22:09:42 -0400 |
parents | c195bd0a5c64 |
children | d9987dbdf91b |
line wrap: on
line diff
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -96,11 +96,12 @@ error ("assignment to structure element failed"); } -octave_value +octave_value_list octave_struct::subsref (const std::string& type, - const std::list<octave_value_list>& idx) + const std::list<octave_value_list>& idx, + int nargout) { - octave_value retval; + octave_value_list retval; int skip = 1; @@ -119,7 +120,7 @@ { Cell t = tmp.index (idx.front (), true); - retval = (t.length () == 1) ? t(0) : octave_value (t, true); + retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true); // We handled two index elements, so tell // next_subsref to skip both of them. @@ -128,7 +129,7 @@ } } else - retval = map.index (idx.front (), true); + retval(0) = map.index (idx.front (), true); } break; @@ -138,7 +139,7 @@ { Cell t = dotref (idx.front ()); - retval = (t.length () == 1) ? t(0) : octave_value (t, true); + retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true); } } break; @@ -156,7 +157,7 @@ // octave_user_function::subsref. if (idx.size () > 1) - retval = retval.next_subsref (type, idx, skip); + retval = retval(0).next_subsref (nargout, type, idx, skip); return retval; }