Mercurial > octave
diff libinterp/corefcn/oct-map.cc @ 23678:dcba41788495
new struct/map constructors
* oct-map.h, oct-map.cc (octave_scalar_map::octave_scalar_map
(const std::map<std::string, octave_value>&)): New constructor.
* ov-struct.h (octave_scalar_struct::octave_scalar_struct
(const std::map<std::string, octave_value>&)): New constructor.
* ov.h, ov.cc (octave_value::octave_value
(const std::map<std::string, octave_value>&)): New constructor.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 22 Jun 2017 15:10:57 -0400 |
parents | 80c42f4cca13 |
children | 3544f88a2bb5 |
line wrap: on
line diff
--- a/libinterp/corefcn/oct-map.cc Thu Jun 22 15:08:29 2017 -0400 +++ b/libinterp/corefcn/oct-map.cc Thu Jun 22 15:10:57 2017 -0400 @@ -167,6 +167,19 @@ return retval; } +octave_scalar_map::octave_scalar_map + (const std::map<std::string, octave_value>& m) +{ + size_t sz = m.size (); + xvals.resize (sz); + size_t i = 0; + for (const auto& k_v : m) + { + xkeys.getfield (k_v.first); + xvals[i++] = k_v.second; + } +} + octave_value octave_scalar_map::getfield (const std::string& k) const {