[C++-sig] Re: call_method

David Abrahams dave at boost-consulting.com
Wed Nov 13 14:33:29 CET 2002


"Brett Calcott" <brett.calcott at paradise.net.nz> writes:

>> >
>> > The interoperability/shared_from_this problems have alternate solutions
> as
>> > described in the techniques "document".
>>
>
> Where is this document? I had a look around the boost files section and
> couldn't find anything that looked relevant.

It was enclosed in Peter's message. Here it is again.

>> Now /that's/ starting to sound intriguing.  I wonder if it's possible
>> to derive our U class from boost::python::objects::instance<>, and
>> automatically generate shared_ptr<> converters for it.
>>
>> Maybe the whole idea of holding a shared_ptr<U> is bogus from the get-go.
>>
>
> I'm not sure what it buys you either. If I have to derive the U
> class from boost::python::objects::instance<> then I have already
> given away non-intrusiveness. 

Which really doesn't matter at all because the U class is
purpose-built.

> Are there some other advantages to using shared_ptr?

Oh, yes: many, many. For example, shared_ptr<U> -> shared_ptr<T> is a
legitimate conversion, even though you haven't intruded on U. And
probably more-importantly, shared_ptr<> interoperates seamlessly in
many contexts and serves as a "one-stop shop" for nearly all smart
pointer needs. Just see the enclosed document for reasons why.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: shared_ptr_techniques.txt
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021113/5ecfa185/attachment.txt>
-------------- next part --------------

-- 
                       David Abrahams
   dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution


More information about the Cplusplus-sig mailing list