H
Helene Pinol
Dear All
I have a problem to insert elements in a combination of containers.
Here is the declaration of the container I would like to use:
vector< set<myElement> > myContainer(vectorSize,set<myElement>());
The size of the vector is known but not yet the sizes of the different
sets.
Within a for loop, I build some myElements and try to insert them in
the correct set with:
myContainer[num].insert(myElement);
num is strictly less than vectorSize
myElement is defined as a struct of 2 int and overloads the operator<
in order to do the insertion
With a vectorSize equals to 1, the first insertion is done OK but it
fails within the second insertion; with a vectorSize>1 sometimes even
the first insertion fails.
What I don't understand is that I've done something similar that works
with a vector of vector of int and using a push_back instead of the
insert.
Thanks for your help.
Hélène.
I have a problem to insert elements in a combination of containers.
Here is the declaration of the container I would like to use:
vector< set<myElement> > myContainer(vectorSize,set<myElement>());
The size of the vector is known but not yet the sizes of the different
sets.
Within a for loop, I build some myElements and try to insert them in
the correct set with:
myContainer[num].insert(myElement);
num is strictly less than vectorSize
myElement is defined as a struct of 2 int and overloads the operator<
in order to do the insertion
With a vectorSize equals to 1, the first insertion is done OK but it
fails within the second insertion; with a vectorSize>1 sometimes even
the first insertion fails.
What I don't understand is that I've done something similar that works
with a vector of vector of int and using a push_back instead of the
insert.
Thanks for your help.
Hélène.