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

Gross, Ashley agross at irobot.com
Thu Oct 5 17:01:42 CEST 2006


foo has no equality operator defined.

Ashley

> -----Original Message-----
> From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org]
On
> Behalf Of David Abrahams
> Sent: Thursday, October 05, 2006 10:41 AM
> To: c++-sig at python.org
> Subject: Re: [C++-sig] intrusive pointer comparison in python
> 
> 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
> 
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig



More information about the Cplusplus-sig mailing list