Create an Account
username: password:
 
  MemeStreams Logo

oh baby, copy it deep!

search

Acidus
Picture of Acidus
My Blog
My Profile
My Audience
My Sources
Send Me a Message

sponsored links

Acidus's topics
Arts
Business
Games
Health and Wellness
Home and Garden
Miscellaneous
Current Events
Recreation
Local Information
Science
Society
Sports
Technology

support us

Get MemeStreams Stuff!


 
oh baby, copy it deep!
Topic: Miscellaneous 8:39 pm EDT, Apr 11, 2005

Copy Constructors you are the thorn in my side. I spent nearly half an hour tracking done something that should have been apparent right way:

If you have an object, which contains pointers to dynamic memory, adding to a vector (or any STL container) does a shallow copy! I needed a deep copy. I had some temp objects I was creating only to add them to an array, and then destory them. When they were destroyed, they would free the memory the object in the vector still referenced.

Segmentation Fault

... sigh... at least its all billable hours.



 
 
Powered By Industrial Memetics
RSS2.0