Thanks Ganon11 for the prompt reply. Your description of what I want to do is exactly right yes. And I can see how your proposed solution would work. I just thought it would be nice to be able to say something like list<ObjectType *> list2 = getCopyOfList() ; and then getCopyOfList() has at the end return list1; and then by using copy constructors, it would automatically make a complete new copy of the list.
It would look really...
User Profile
Collapse
-
making a copy of a list of pointers to objects
Hello,
i just wanted to ask what the best way would be to make a copy of a list of pointers to objects. The objects themselves each contain more pointers to other objects. All of these pointers should point to new objects in the copied list and not to the original objects.
I thought it might be good to write a copy constructor for the list but I'm not sure how I would do that. Do I have to use inheritance?
...
No activity results to display
Show More
Leave a comment: