[C++-sig] Re: Automation of Python object retrieval

David Abrahams dave at boost-consulting.com
Sun Mar 28 07:33:16 CEST 2004

Pierre Barbier de Reuille <pierre.barbier at cirad.fr> writes:

> I have a problem with the boost::python::object contruction. I'd want to
> know if there is a way to automate the retrieval of the existing Python
> object when I hold a Pointer on the C++ base class and that the class is
> extended in Python. Here's an example of what I do now :

<snip big example with no mention of boost::python::object>

> ======================
> All the equality tests fails because the other in detected as a Base
> object and not a Derived object !!!

detected where?

> But, if I replace the BaseWrap::operator== by :

<snip some workaround>

> I get the wanted behaviour. But I wonder if there is a cleaner method to
> do that ? 

Sorry, I stared at your example for 5 minutes and couldn't figure out
what you were after.  Is there a reason that Holder can't hold a
shared_ptr<Base> or a boost::python::object?

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list