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

David Abrahams dave at boost-consulting.com
Sat Oct 7 14:47:33 CEST 2006


Alex Mohr <amohr at pixar.com> writes:

>>> 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.

You're not.  Thanks for pointing out what I should have seen.

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




More information about the Cplusplus-sig mailing list