[C++-sig] copy constructors and multiple instances

Dave Abrahams dave at boostpro.com
Fri Sep 2 23:15:32 CEST 2011


on Fri Sep 02 2011, Josh Stratton <strattonbrazil-AT-gmail.com> wrote:

> Well, right now I'm just passing "this" from inside the scene object,
> so does that need to be wrapped in a shared pointer?

That's a pretty vague description of what you're doing, so it's hard to
say.  I suggest you reduce your question to a minimal case that doesn't
involve any of your domain-specific stuff.  Then it will be easy to
answer.

>
> On Fri, Sep 2, 2011 at 12:19 PM, Dave Abrahams <dave at boostpro.com> wrote:
>>
>> on Thu Sep 01 2011, Jim Bosch <talljimbo-AT-gmail.com> wrote:
>>
>>> boost::python::register_ptr_to_python< boost::shared_ptr<Scene> >();
>>>
>>> This allows you to return shared_ptr to Python, but because a
>>> boost::shared_ptr can use an arbitrary deleter, Boost.Python can
>>> convert any wrapped Scene object (even one that doesn't hold a
>>> shared_ptr<Scene>) into a shared_ptr<Scene> with correct reference
>>> counting.
>>
>> I might have forgotten by now, but I don't think you need to register
>> shared_ptr, and I don't think the above will have any effect.  IIRC I
>> made sure shared_ptr support "just works" out-of-the-box.
>>
>> --
>> Dave Abrahams
>> BoostPro Computing
>> http://www.boostpro.com>
>> _______________________________________________
>> Cplusplus-sig mailing list
>> Cplusplus-sig at python.org
>> http://mail.python.org/mailman/listinfo/cplusplus-sig>

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com



More information about the Cplusplus-sig mailing list