[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-cpp-sig
Subject:    Re: [C++-sig] [boost.python] How can I wrap operator==?
From:       Hans Meine <hans_meine () gmx ! net>
Date:       2010-01-13 12:54:24
Message-ID: 201001131354.25672.hans_meine () gmx ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Mittwoch 13 Januar 2010, Roman Yakovenko wrote:
> On Wed, Jan 13, 2010 at 8:57 AM, blp330 <blp330@msn.com> wrote:
> > class Document
> > {
> > public:
> >  ....
> >
> >  bool operator==(const Document& other) const
> >  {
> >  return Compare(other);
> >  }
> [...]
> If I understand you right, you need:
>
> 1. define new global function, which takes Document& as the first argument
>
> bool Document_EqualWrap( const Document& x, const Document& y ){...}

Not necessary AFAIK, a member function should work, too.
(i.e. directly exposing &Document::operator==)

> 2. Expose it:
>
> ...
> .def( "__eq__", &Document_EqualWrap )
>
> Is not the working code, but it should give you a direction.

Yes, I think that's what he was missing.

-- 
Ciao, /  /                                                    .o.
     /--/                                                     ..o
    /  / ANS                                                  ooo

["signature.asc" (application/pgp-signature)]

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic