summaryrefslogtreecommitdiff
path: root/Examples/test-suite/cpp11_template_typedefs.i
blob: d6a1a3c85579c3cd63f2307d6b48a8755ed1a09e (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
/* This testcase checks whether SWIG correctly parses alias templates. */
%module cpp11_template_typedefs

%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) TypedefName;
%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) MyIntKeyClass;
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) PF;

%inline %{
template< typename T1, typename T2, int >
class SomeType {
  T1 a;
  T2 b;
  int c;
};

// template aliasing
template< typename T2 >
using TypedefName = SomeType<char*, T2, 5>;

// type aliasing
typedef void (*PFD)(double);            // Old style
using PF = void (*)(double);            // New introduced syntax


// use of template aliasing
template<typename Key,typename Val>
class MyCPP11Class {
};
template<typename VAL> using MyIntKeyClass = MyCPP11Class<int,VAL>;
MyIntKeyClass<char> intchar;
%}