
On Sat, 2008-04-12 at 03:29 +0300, Peter Dimov wrote:
It won't if we use
shared_ptr( detail::shared_count pn, Y* px );
and swap(pn,pn_) as poor man's move.
I updated the patch to replace ignore_enable_shared_from_this_tag with this approach. Which means that shared_ptr no longer contains any traces of enable_shared_from_this[_light], only some generally useful extensions, which is IMHO a good sign. I also replaced the name sp_notify_observer with sp_accept_owner.
Let me bring up something else. Should
shared_ptr(Y* p, D d);
call sp_accept_owner(this, p), or should it call sp_accept_owner(this, p, &d'), where d' is the stored deleter?
Since the pointer to the deleter could always be retrieved by sp_accept_owner via the first parameter, the only benefit is that the deleter's type D is passed, right? To me it seems cleaner if sp_accept_owner should not have any direct link to the way *how* the shared_ptr was created, just the fact that it has been created. IMHO it should says: "This shared_pointer now owns this object" and not "This shared_ptr now owns this object and was created with this deleter". I simply fail to see what this should be good for, but maybe you have a use case in mind? Regards, Daniel