[C++-sig] Is there a way to automatically convert a smart_ptr to a held_type (try 2)
Allen Bierbaum
abierbaum at gmail.com
Thu Sep 7 17:09:52 CEST 2006
>
> Thanks for your help. I will let you know if anything else crops up
> but I think I am starting to understand this part of boost.python much
> better now so hopefully I will be able to fix it myself. :)
It looks like everything related to the auto-converting to ref_ptr
held type and handling of converting to and from None.
I have one remaining problem that I know of with this code. How do I
make it possible to compare the wrapped ref_ptrs for equality? I am
assuming that I need to add an __eq__ operator for the ref_ptr types
but since they are used as held_type I am not really exposing them in
the "normal" way.
This is how it is behaving right now (note: all the objects here have
ref_ptr held type)
>> n = osg.Node.create()
>> g = osg.Group.create()
>> n.setCore(g)
>> g
<osg._osg.Group object at 0xb785fcac>
>> n.getCore()
<osg._osg.Group object at 0xb785f16c>
>> g == n.getCore()
False
Does anyone know if this is also an issue when wrapping an API and
using boost::shared_ptr<> as the held type? If so, how is that case
handled?
Thanks,
Allen
More information about the Cplusplus-sig
mailing list