summaryrefslogtreecommitdiff
path: root/Examples/test-suite/inplaceadd.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/inplaceadd.i')
-rw-r--r--Examples/test-suite/inplaceadd.i40
1 files changed, 40 insertions, 0 deletions
diff --git a/Examples/test-suite/inplaceadd.i b/Examples/test-suite/inplaceadd.i
new file mode 100644
index 000000000..91ef84bd2
--- /dev/null
+++ b/Examples/test-suite/inplaceadd.i
@@ -0,0 +1,40 @@
+%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;
+ }
+ };
+%}