summaryrefslogtreecommitdiff
path: root/Examples/test-suite/template_construct.i
blob: ac418f8e5360c6e3efcb9fbacdfce7c357f0f6b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
%module template_construct

// Tests templates to make sure an extra <> in a constructor is ok.

%inline %{
template<class T> 
class Foo {
    T y;
public:
#ifdef SWIG
    Foo<T>(T x) : y(x) { }
#else
    // Modern compilers reject this, so feed the compiler the corrected
    // version.
    Foo(T x) : y(x) { }
#endif
};

%}

%template(Foo_int) Foo<int>;