M
magnus.moraberg
Hi,
I have the following code which fails to compile -
MField<int> mFieldInt;
mFieldInt.insert(mFieldInt.begin(),10);
because mFieldInt.begin() returns a const_iterator. The following code
does compile -
MField<int>::iterator i; // how do I initialize i?
mFieldInt.insert(i,10);
MField<int> stores a number of ints internally using a vector. Here's
the specification for MField -
http://www.h3dapi.org/uploads/api/H3DAPI_20_beta/docs/H3DAPI/html/classH3D_1_1MField.html
My question though is, why does MField have an insert function
associated with it if its begin function returns a const_iterator? How
can one insert something into a MField object when the only function
that returns an iterator (instead of a const_iterator) is the insert
function itself. I'm totally confused by this.
How can I insert a value at the start of an MField object's internal
vector?
Thanks for your help,
Barry
I have the following code which fails to compile -
MField<int> mFieldInt;
mFieldInt.insert(mFieldInt.begin(),10);
because mFieldInt.begin() returns a const_iterator. The following code
does compile -
MField<int>::iterator i; // how do I initialize i?
mFieldInt.insert(i,10);
MField<int> stores a number of ints internally using a vector. Here's
the specification for MField -
http://www.h3dapi.org/uploads/api/H3DAPI_20_beta/docs/H3DAPI/html/classH3D_1_1MField.html
My question though is, why does MField have an insert function
associated with it if its begin function returns a const_iterator? How
can one insert something into a MField object when the only function
that returns an iterator (instead of a const_iterator) is the insert
function itself. I'm totally confused by this.
How can I insert a value at the start of an MField object's internal
vector?
Thanks for your help,
Barry