Re: container within a container issue: set in the map
On Sep 19, 5:52 am, puzzlecracker <ironsel2...@gmail.com> wrote:
Guys, what is more preferable, given that I don't have access
to boost or shared pointers:
std::map<T*, std::set<T2*> * > *_myMap;
vs.
std::map<T*, std::set<T2*> > *myMap;
Notice that in the latter, containing set is not a pointer.
Could there be a drawbacks with the former, like copying over
when trying to insert elements into it?
I'll second Kai-Uwe's comments, but with regards to the question
about copying: the node based containers (list, set and map)
never copy an object once it is in the container. More
generally, check the container specifications: if insert and
erase don't invalidate references and pointers into the
container (except for references or pointers to the erased
element), then copying can't take place.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34