Word to the wise
Monday, 27 October 2003 13:33Don't copy pointers to child objects (has-a relationship) in your operator =; sharing common children this way will bite you when you try to destroy your child objects and they've already been destroyed.
Fortunately, the STL implementation we use replaces internal pointers with "magic" nonsense values after the object is destroyed so you at least get a segfault and notice.
no subject
Date: Monday, 27 October 2003 06:48 (UTC)If you're unlucky, you're just screwed."
Jason Zych, Data Structures in C++, UIUC 2003.
no subject
Date: Monday, 27 October 2003 06:52 (UTC)have you consider smart pointers?
Date: Monday, 27 October 2003 08:37 (UTC)The implementation I use at work is not available publicly but I've heard these are pretty good:
http://www.boost.org/libs/smart_ptr/index.htm
no subject
Date: Monday, 27 October 2003 11:26 (UTC)