28 Apr
2007
28 Apr
'07
4:29 p.m.
Robert Marion wrote:
So, I've been using std::auto_ptr for some time, and have always been careful to either create a copy constructor or make it private (same for assignment). But now that I am becoming a boost::shared_ptr convert, I think that is no longer necessary. Is that so?
It's not necessary if the generated copy constructor has the semantics that you want. Keep in mind that all copies of shared_ptr refer to the same pointee. So it depends on the context. If you aren't sure, disabling the copy constructor is still a good guideline to apply by default.