From: batov (batov_at_[hidden])
Date: 2007-10-18 04:28:07
Phil, thank you for your encouragement and
Peter, thank you for the pointers. Much and truly appreciated.
I'll definitely have a look at both Alan's and Peter's implementations if I
can make use of those. It's Saturday -- my family-duties day -- and I am
just running out the door. After a rrrreally quick look the grip_ptr seems
to provide a deep-copy semantics without exposing private implementation. It
that is the case, then Alan and Peter (who implemented a similar thing) are
definitely smarter than I am as I was not able to figure out how to achieve
that (without exposing implementation details). Then I'll steal :-) their
idea (with proper acknowledments :-)).
That will have to be done in addition to my currently proposed
shared_ptr-based implementation as, for example, my current usage pattern is
such that I use one data repository/implementation and share/pass many
smart-pointer type instances pointing to that sole implementation.
Will let you know how it all fired soon.
"Phil Endecott" <spam_from_boost_dev_at_[hidden]> wrote in message
> Peter Dimov wrote:
>> Phil Endecott:
>>> Vladimir Batov wrote:
>>>> Given I've been using this Pimpl idiom quite extensively lately I've
>>>> writing the same scaffolding over and over again.
>>> Maybe we need something with a mixture of features from scoped_ptr and
>>> shared_ptr. scoped_ptr does everything that I need for a pimpl, except
>>> that it can't delete the incomplete implementation type. shared_ptr
>>> can delete the incomplete implementation, but it has the unneeded
>>> overhead of reference counting and thread safety issues. So, can the
>>> incomplete deletion feature of shared_ptr be extracted and added to
>>> scoped_ptr? I have just had a quick look at the shared_ptr
>>> implementation to see how deletion works, but it's too clever for me to
>> Alan Griffiths has written a similar smart pointer, arg::grin_ptr:
> Thanks Peter, that's exactly what's needed. And very well described by
> Alan on that page.
> It seems that the trick needed to allow incomplete types to be deleted
> is the same one that allows a shared_ptr to be given a custom deleter,
> e.g. so that I can free() things that have been malloc()ed by C code.
> A smart pointer with these features would be great for Boost.
> Vladimir, would you like to revise your pimpl template to use this?
> Regards, Phil.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk