[C++-sig] how to handle bare references with a shared_ptr HeldType

Hans Meine meine at kogs1.informatik.uni-hamburg.de
Thu Sep 22 19:32:32 CEST 2005


On Thursday 22 September 2005 16:37, Gregory Price wrote:
> Is there a way to tell Boost.Python not to make a shared_ptr
> for this return value -- to override the HeldType just for this
> function's return value?  Alternatively, to tell Boost.Python
> always to leave bare A references as they are?
>
> Or perhaps there's a simpler solution that I'm missing.

Ah.  I knew I was overlooking something.
Is changing the HeldType an option for you?

OTOH, if you use return_internal_reference, BP should know that creating a 
shared_ptr with a refcount of 1 is evil..  is that really what it does?

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



More information about the Cplusplus-sig mailing list