Mercurial > hg > octave-nkf
changeset 4937:4cf211c83158
[project @ 2004-08-06 16:21:20 by jwe]
author | jwe |
---|---|
date | Fri, 06 Aug 2004 16:21:20 +0000 |
parents | e63617efbd3f |
children | 703d97b89507 |
files | src/oct-map.cc |
diffstat | 1 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -116,25 +116,27 @@ Octave_map concat (const Octave_map& ra, const Octave_map& rb, const Array<int>& ra_idx) { - if (ra.length() != rb.length()) - { - error ("field name mismatch in structure concatenation"); - return Octave_map (); - } + Octave_map retval; - Octave_map retval; - for (Octave_map::const_iterator pa = ra.begin (); pa != ra.end (); pa++) + if (ra.length() == rb.length()) { - Octave_map::const_iterator pb = rb.seek (ra.key(pa)); - if (pa == rb.end()) + for (Octave_map::const_iterator pa = ra.begin (); pa != ra.end (); pa++) { - error ("field name mismatch in structure concatenation"); - return Octave_map (); - } + Octave_map::const_iterator pb = rb.seek (ra.key(pa)); + + if (pa == rb.end ()) + { + error ("field name mismatch in structure concatenation"); + break; + } - retval.assign (ra.key(pa), ra.contents(pa).insert(rb.contents(pb), - ra_idx)); + retval.assign (ra.key(pa), + ra.contents(pa).insert (rb.contents(pb), ra_idx)); + } } + else + error ("field name mismatch in structure concatenation"); + return retval; }