[C++-sig] intrusive pointer comparison in python

Alex Mohr amohr at pixar.com
Thu Oct 5 00:32:30 CEST 2006


> Unfortunately, the class that I'm using isn't comparable, I'm bassically looking for a direct comparison of the held pointers.

That's what I said.  Have it compare the pointers.

template <typename Ptr>
static bool are_ptrs_equal(Ptr const &self,
                            Ptr const &other)
{
     return self == other;
}

class_<foo,fooHandle>("foo")
     .def("__eq__", are_ptrs_equal<fooHandle>);

> I'm not sure what you mean by "objects that are exposed to python polymorphically", can you please elaborate?

http://www.boost.org/libs/python/doc/tutorial/doc/html/python/exposing.html#python.class_virtual_functions

Alex



More information about the Cplusplus-sig mailing list