PageRenderTime 3ms CodeModel.GetById 1ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 6
 7%inline %{
 8  struct A 
 9  {
10    int val;
11    
12    A(int v): val(v)
13    {
14    }
15    
16    A& operator+=(int v) 
17    {
18      val += v;
19      return *this;
20    }
21
22    A& operator+=(const A& a) 
23    {
24      val += a.val;
25      return *this;
26    }
27
28    A& operator-=(int v) 
29    {
30      val -= v;
31      return *this;
32    }
33
34    A& operator*=(int v) 
35    {
36      val *= v;
37      return *this;
38    }
39  };
40%}