[C++-sig] [boost.python] How can I wrap operator==?

Roman Yakovenko roman.yakovenko at gmail.com
Tue Jan 12 20:55:16 CET 2010


On Mon, Jan 11, 2010 at 6:05 AM, blp330 <blp330 at msn.com> wrote:
>
> Hi,
>
> I want to wrap operator== for my object, Py++ generates that:
>
>        Document_exposer.def( bp::self != bp::self);
>        Document_exposer.def( bp::self == bp::self );
>
> But I want to do something more, so I try to wrap it with:
>
>        Document_exposer.def(
>            bp::self != bp::self
>            , &Document__NotEqualWrap );
>        Document_exposer.def(
>            bp::self == bp::self
>            , &Document__EqualWrap );
>
> It can't be compiled...
>
> How can I do?

It is not clear what you are asking for.

If the "Document" class has special function for comparison, than may
be you can define few global operators ( == and != ).

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/


More information about the Cplusplus-sig mailing list