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

David Abrahams dave at boost-consulting.com
Thu Oct 5 16:41:15 CEST 2006


Alex Mohr <amohr at pixar.com> writes:

>> 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>);

isn't this the same as

  class_<foo,fooHandle>("foo")
        .def(self == self)
        ;
?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list