Assign Cell to octave map: error
John W. Eaton
jwe at octave.org
Sat Mar 14 14:09:45 CDT 2009
On 14-Mar-2009, Alexander Rusakov wrote:
| I am a newbie in development within Octave and I must apologize for possibly
| stupid questions. But I still can not find a rationale that for
| std:,L66(Bmap<string,Cell> octave requests of all objects Cell type some
| special internal properties like its dimension.
|
| Why can't I have two cells with different properties in one map? I am not
| aware of such a limitation of std::map. Is it a limitation of octave_map or
| a Cell class? If yes then probably it must be documented in some API
| description?
A structure in Octave is a "structure array", so you can define an
object that can be indexed with
s(i,j,k).field
(for example). All fields of the structure have to have the same
array size. The data structure chosen to store the array elements
corresponding to each field name just happens to be a Cell because it
works for that purpose. Maybe it would be clearer for you if the
internal object contained in an Octave_map was
std::map<std::string, ArrayN<octave_value> >
instead of std::map<std::string, Cell>? But a Cell is derived from
ArrayN<octave_value> and provides a few convenient functions, so I
think that's why I decided to use Cell instead of ArrayN<octave_value>.
| The other problem I faced is a lack of documentation :(. Probably it is
| worth to add a couple of more examples to cell and octave_map documentation.
| For instance example from :
|
| http://www.nabble.com/Vectors-of-Structures-in-C%2B%2B-td3835119.html#a3858205
|
| in documentation could help me much.
You are of course welcome to submit patches to the documentation. But
the internals of Octave are not really considered "stable" so I'm not
convinced we should document them.
jwe
More information about the Bug-octave
mailing list