[C++-sig] shared_ptr vs. intrusive_ptr

Hans Meine meine at informatik.uni-hamburg.de
Wed Jul 23 11:19:36 CEST 2008


Am Dienstag, 22. Juli 2008 16:24:13 schrieb Jeff Webb:
> Hans Meine wrote:
> >> sp_counted_impl_p:
> >>   sp_counted_base:
> >>     int use_count_;   (4 bytes)
> >>     int weak_count_;  (4 bytes)
> >>   X *                 (4 or 8 bytes)
> >>   ???                 (4 or 8 bytes)
> >
> > I think the ??? may be the virtual method table pointer of
> > sp_counted_base.
>
> Oh yes, of course.  Thanks for catching this!

And of course this is needed exactly to support deleters; ATM I do not recall 
whether the "[why] do I need deleters" discussion was with you or with 
Gennadiy.  (I.e. someone asked "can intrusive_ptr/my_smart_ptr be made to 
support the same set of features as shared_ptr?" - this pointer can not be 
saved if you want the same features.)

-- 
Ciao, /  /
     /--/
    /  / ANS



More information about the Cplusplus-sig mailing list