mirror of
https://github.com/boostorg/python.git
synced 2026-01-20 04:42:28 +00:00
Another fix.
[SVN r25576]
This commit is contained in:
@@ -828,19 +828,28 @@ struct number
|
||||
: boost::<a href=
|
||||
"../../../utility/operators.htm#grpd_oprs">integer_arithmetic</a><number>
|
||||
{
|
||||
number(long x_) : x(x_) {}
|
||||
operator long() const { return x; }
|
||||
explicit number(long x_) : x(x_) {}
|
||||
operator long() const { return x; }
|
||||
|
||||
number& operator+=(number const& rhs)
|
||||
{ x += rhs; }
|
||||
number& operator-=(number const& rhs)
|
||||
{ x -= rhs; }
|
||||
number& operator*=(number const& rhs)
|
||||
{ x *= rhs; }
|
||||
number& operator/=(number const& rhs)
|
||||
{ x /= rhs; }
|
||||
number& operator%=(number const& rhs)
|
||||
{ x %= rhs; }
|
||||
template <class T>
|
||||
number& operator+=(T const& rhs)
|
||||
{ x += rhs; return *this; }
|
||||
|
||||
template <class T>
|
||||
number& operator-=(T const& rhs)
|
||||
{ x -= rhs; return *this; }
|
||||
|
||||
template <class T>
|
||||
number& operator*=(T const& rhs)
|
||||
{ x *= rhs; return *this; }
|
||||
|
||||
template <class T>
|
||||
number& operator/=(T const& rhs)
|
||||
{ x /= rhs; return *this; }
|
||||
|
||||
template <class T>
|
||||
number& operator%=(T const& rhs)
|
||||
{ x %= rhs; return *this; }
|
||||
|
||||
long x;
|
||||
};
|
||||
@@ -848,7 +857,7 @@ struct number
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE(demo)
|
||||
{
|
||||
class_<number>("number")
|
||||
class_<number>("number", init<long>())
|
||||
// interoperate with self
|
||||
.def(self += self)
|
||||
.def(self + self)
|
||||
|
||||
Reference in New Issue
Block a user