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
54
55
56
57
58
59
60
61
|
%module template_typedef_class_template
#ifdef SWIGOCAML
%warnfilter(SWIGWARN_PARSE_KEYWORD) val;
#endif
%inline %{
namespace Standard {
template <class T, class U > struct Pair {
T first;
U second;
};
}
%}
// previously these typemaps were erroneously being used as iterator was not correctly scoped in Multimap
%typemap(out) Standard::Pair<Standard::iterator, Standard::iterator> "_this_will_not_compile_iterator_"
%typemap(out) Standard::Pair<Standard::const_iterator, Standard::const_iterator> "_this_will_not_compile_const_iterator_"
%{
namespace Standard {
template<class Key, class T> class Multimap {
public:
typedef Key key_type;
typedef T mapped_type;
class iterator {};
class const_iterator {};
// test usage of a typedef of a nested class in a template
Standard::Pair<iterator,iterator> equal_range_1(const key_type& kt1) { return Standard::Pair<iterator,iterator>(); }
Standard::Pair<const_iterator,const_iterator> equal_range_2(const key_type& kt2) const { return Standard::Pair<const_iterator,const_iterator>(); }
};
}
%}
namespace Standard {
template<class Key, class T> class Multimap {
public:
typedef Key key_type;
typedef T mapped_type;
class iterator;
class const_iterator;
// test usage of a typedef of a nested class in a template
Standard::Pair<iterator,iterator> equal_range_1(const key_type& kt1) {}
Standard::Pair<const_iterator,const_iterator> equal_range_2(const key_type& kt2) const {}
};
}
%inline %{
struct A {
int val;
A(int v = 0): val(v) {}
};
%}
%template(PairA) Standard::Pair<int, A*>;
%template(MultimapA) Standard::Multimap<int, A*>;
|