/trunk/Examples/test-suite/inplaceadd.i

# · Swig · 40 lines · 33 code · 7 blank · 0 comment · 0 complexity · 6cbc18687be03618cbc689b724c51987 MD5 · raw file

  1. %module inplaceadd
  2. %{
  3. #include <iostream>
  4. %}
  5. %inline %{
  6. struct A
  7. {
  8. int val;
  9. A(int v): val(v)
  10. {
  11. }
  12. A& operator+=(int v)
  13. {
  14. val += v;
  15. return *this;
  16. }
  17. A& operator+=(const A& a)
  18. {
  19. val += a.val;
  20. return *this;
  21. }
  22. A& operator-=(int v)
  23. {
  24. val -= v;
  25. return *this;
  26. }
  27. A& operator*=(int v)
  28. {
  29. val *= v;
  30. return *this;
  31. }
  32. };
  33. %}