add inplace test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5857 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b0ca61077e
commit
74eb5b7dc3
3 changed files with 50 additions and 0 deletions
31
SWIG/Examples/test-suite/python/inplaceadd.i
Normal file
31
SWIG/Examples/test-suite/python/inplaceadd.i
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
%module inplaceadd
|
||||
|
||||
|
||||
%inline %{
|
||||
struct A
|
||||
{
|
||||
int val;
|
||||
|
||||
A(int v): val(v)
|
||||
{
|
||||
}
|
||||
|
||||
A& operator+=(int v)
|
||||
{
|
||||
val += v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
A& operator-=(int v)
|
||||
{
|
||||
val -= v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
A& operator*=(int v)
|
||||
{
|
||||
val *= v;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue