-
July 10th, 2009, 03:56 AM
#1
Copy constructor (invoking implicit one in user defined?)
I have a rather big class with many elementary data members (int, bool, etc.). The class contains one dynamically allocated member as well.
Due to this dynamic member, I have to define my copy constructor to properly perform deep copy.
However, there's also need to copy (assign) each and every elementary member in my copy constructor. This is tedious and error prone as I have to remember to update the copy contructor each time I add a data member to the class.
Is there any possibility how to solve the issue in more elegant way?
Is it somehow possible to invoke implicit (compiler defined) copy costructor to perform shallow copy and add just deep copy of the dynamic member?
Thanks for any advice.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|