Fwd: [smart containers] _M_clear()

Bob Walters bob.s.walters@gmail.com
Fri Sep 26 18:33:00 GMT 2008


Phil,

I was thinking about your original proposal to have release() get
called from within the clear() method.  With your particular pointer,
can the assignment "ptr = NULL;" have the same effect as calling
release() ?   I was thinking that such assignments could be added to
the container code after the call to deallocate(). Your pointer would
see that call, could confirm that ref counts on the set have dropped
to 0, and release() their current contents.  Obviously, that code
would work equally well for standard pointers as well as smart ones.

If that doesn't help with your particular case, then I agree we could
just use what you've done in your note as an alternative.  I remember
you had some minor concerns about having to write your allocator with
a deallocate() method that takes the pointer by reference, and thought
this might eliminate the need for that.

Thanks,
- Bob



More information about the Libstdc++ mailing list