28 Aug
2005
28 Aug
'05
12:01 p.m.
Matthias Kaeppler wrote:
Peter Dimov wrote:
One reason is that the pointer constructor assumes ownership of the pointer and as such, it imposes the requirement that the pointer has to be delete-able. Not sure what you're getting at here. Do you mean, you want to avoid statements like:
coll.insert(NULL); // coll is a collection of smart pointers ?
No, it's statements like coll.insert( &x ); coll.insert( this ); coll.insert( p ); // where p doesn't come from new that need to be avoided as they would lead to undefined behavior.