snk_kid you are right that the "own and make copies" method removes many of the benifits of using pointers in the first place ... but not all. For instance, if you are going to actually change the values of your lists objects and don't want to affect the original sources list ... you NEED copies. Of course, as you said, you could just store items instead of pointers then, but then what would you do if you had to sort or rearange your list a lot ...
all i'm sayin is that there are valid reasons for every possible type of storage and ownership combination you can think of ...
to the OP, I'm at work right now, but I'll try to post you an example when I get home tonight.
an off the top of my head quick and dirty snippet (I am leaving off obvious stuff like extra functions, typedefs, includes, and namespace qualifiers) not directly from your framework would be:
class Example { private: typedef list<SomeType*> ListType; ListType objects; public: Example(const Example &rhs); };Example::Example(const Example &rhs) { objects.resize(rhs.size(); ListType::iterator obj_it = objects.begin(); foreach(ListType::iterator rhs_it = rhs.begin(); rhs_it != rhs.end(); ++rhs.it) { *obj_it = new SomeType(*(*rhs_it)); ++obj_it; } }
I know it's a little ugly ... I'm sure I could do better given 5 more minutes ... and I wish I had a c++ project set up to compile / test it ... but ...
good luck.