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

Alex Mohr amohr at pixar.com
Thu Oct 5 18:42:21 CEST 2006


>> class_<foo,fooHandle>("foo")
>>      .def("__eq__", are_ptrs_equal<fooHandle>);
> 
> isn't this the same as
> 
>   class_<foo,fooHandle>("foo")
>         .def(self == self)
>         ;
> ?

Unless I'm mistaken, no I don't think so.  I think that 'self == self' 
will generate an overload expecting 'foo' arguments, and will compare 
the 'foo' objects directly, rather than comparing 'fooHandle's.  Ashley 
said that 'foo' is not comparable.

Let me know if I'm misreading operators.hpp though.

Alex



More information about the Cplusplus-sig mailing list