/trunk/Examples/test-suite/inplaceadd.i
Swig | 40 lines | 33 code | 7 blank | 0 comment | 0 complexity | 6cbc18687be03618cbc689b724c51987 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- %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;
- }
- };
- %}