|
Boost Users : |
From: Benjamin Schmeling (Benjamin_Schmeling_at_[hidden])
Date: 2005-01-18 12:52:24
Hi,
I am wrapping a class "bigint" from c++ to python. I have overloaded the add
method to do something like this on python:
>>>n=bigint(5);
>>>n+5L
5
This works well, but if I try to do it vice versa my overloaded add method
isn't called by python:
>>>n=bigint(5);
>>>5L+n
Causes error.
My add methods look like this:
bigint add_bigint_l(bigint const& b, long_ const& l)
bigint add_l_bigint(long_ const& l,bigint const& b)
and are defined by
.def("__add__", add_bigint_l)
.def("__add__", add_l_bigint)
Can someone tell me howto realize it?
Benjamin Schmeling
-- GMX im TV ... Die Gedanken sind frei ... Schon gesehen? Jetzt Spot online ansehen: http://www.gmx.net/de/go/tv-spot
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net