|
Re: custom less than operator? to_python_converter for multiple destination: msg#00356python.c++
Gavin Doughtie <gdoughtie@xxxxxxxxxxxxxxxxxxx> writes: > So, I'm wrapping a class that defines "<" as an internal class with a > bool operator() like so: > > struct Baz > { > struct Less > { > bool operator() (const Baz& a, const Baz& b) const; > } > }; > > Inconveniently, it also does NOT define operator < in Baz. How would I > wrap this to make Baz objects in Python use Baz::Less::operator() as > the < operator? bool BazLess(Baz const& a, Baz const& b) { return Baz::Less()(a,b); } class <Baz>("Baz") .def("__lt__", BazLess) ... HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [newbie] Question on embedding/extending with boost::python: 00356, Dirk Gerrits |
|---|---|
| Next by Date: | Re: Re: custom less than operator? to_python_converter for multiple destination types?: 00356, Gavin Doughtie |
| Previous by Thread: | custom less than operator? to_python_converter for multiple destination types?i: 00356, Gavin Doughtie |
| Next by Thread: | Re: Re: custom less than operator? to_python_converter for multiple destination types?: 00356, Gavin Doughtie |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |