/trunk/Examples/test-suite/inplaceadd.i
# · Swig · 40 lines · 33 code · 7 blank · 0 comment · 0 complexity · 6cbc18687be03618cbc689b724c51987 MD5 · raw file
- %module inplaceadd
- %{
- #include <iostream>
- %}
- %inline %{
- struct A
- {
- int val;
-
- A(int v): val(v)
- {
- }
-
- A& operator+=(int v)
- {
- val += v;
- return *this;
- }
- A& operator+=(const A& a)
- {
- val += a.val;
- return *this;
- }
- A& operator-=(int v)
- {
- val -= v;
- return *this;
- }
- A& operator*=(int v)
- {
- val *= v;
- return *this;
- }
- };
- %}