aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/cpp11_template_double_brackets.i
blob: d7522c9f077c59ef11407220f121d9ed9aadb2b9 (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
44
45
46
47
48
49
50
51
52
53
/* This interface checks whether SWIG supports the new double angled brackets
   in the template syntax without having a space in between. This feature was
   introduced in new C++11 standard.
*/
%module cpp11_template_double_brackets
%inline %{
#include <map>
std::map<int,std::map<int, double>> map1;
std::map< int,std::map<int, double> > map2;

std::map<int,std::map<int, std::map<int, double>>> map3;
std::map<int,std::map<int, std::map<int, std::map<int, double>>>> map4;
%}

// Check streaming operators are still okay
%rename(ExtractionOperator) operator>>;
%rename(InsertionOperator) operator<<;

%inline %{
class ABC {
public:
  int a;
  int operator>>(ABC &) { return 0; }
  int operator<<(ABC &) { return 0; }
};

class DEF {
public:
  int a;
  int operator<<(DEF &) { return 0; }
  int operator>>(DEF &) { return 0; }
};


template<class T>
class ABC2 {
public:
  int a;

  template<typename U>
    U operator>>(ABC &);

  template<typename U>
    U operator<<(ABC &);
};
%}

// Test shifts are still working
%inline %{
int shift_init1 = 4 << 2 >> 1;
int shift_init2 = 4 >> 2 << 1 << 1 >> 2;
%}