summaryrefslogtreecommitdiff
path: root/Examples/test-suite/template_classes.i
blob: d357e418ee9851cbdfae7b65769d05ce50234e35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* File : template_classes.i */
/* Tests the use of one templated class within another */

%module template_classes

%inline %{

template <class T>
class Point {
public:
  T getX() {return x;}
private:
  T x;
};

template <class T>
class RectangleTest {
public:
  Point<T>& getPoint() {return point;}
  void setPoint(Point<T>& value) {point = value;}

  static int static_noargs() { return 0; }
  static int static_onearg(int i) { return i; }
private:
  Point<T> point;

  template <class Data>
  struct pair2nd_eq
  {
  };

  struct Foo : Point<int>
  {
  };
  
  Foo foo;
};

%}

%template(PointInt) Point<int>;
%template(RectangleInt) RectangleTest<int>;