[C++-sig] intrusive pointer comparison in python
David Abrahams
dave at boost-consulting.com
Thu Oct 5 16:38:09 CEST 2006
"Gross, Ashley" <agross at irobot.com> writes:
> I’ve got a problem when comparing intrusive pointers in python.
> I’ve got a class wrapped in python that does not support the
> equality operator. In C++ intrusive pointers support equality
> comparisons by comparing the pointers that they hold. However in
> python, this does not appear to work. For example:
>
> intrusive_ptr1=foo()
>
> intrusive_ptr2=intrusive_ptr1
>
> intrusive_ptr1==intrusive_ptr2
>
> This gives me false. The only comparison that seems to work is comparing an object to itself:
>
> intrusive_ptr1==intrusive_ptr1
Both of your examples compare an object to itself. In the first
example the names intrusive_ptr1 and intrusive_ptr2 are bound to the
same object.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list