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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
%module template_class_reuse_name
// One parameter templates
%inline %{
namespace Space {
template <bool B> struct Bool1 { void tt(){}; void ff(){}; };
template <bool B = true> struct Bool2 { void tt(){}; void ff(){}; };
template <bool B> struct Bool3 {};
template <> struct Bool3<true> { void tt(){}; };
template <> struct Bool3<false> { void ff(){}; };
template <bool B = true> struct Bool4 { void tt(){}; };
template <> struct Bool4<false> { void ff(){}; };
}
%}
// Instantiated names are the same as C++ template name
%template(Bool1) Space::Bool1<true>;
%template(Bool2) Space::Bool2<true>;
%template(Bool3) Space::Bool3<true>;
%template(Bool4) Space::Bool4<true>;
// Instantiated names are not the same as C++ template name
%template(Bool1False) Space::Bool1<false>;
%template(Bool2False) Space::Bool2<false>;
%template(Bool3False) Space::Bool3<false>;
%template(Bool4False) Space::Bool4<false>;
// Forward declared templates
%inline %{
namespace Space {
template <bool B> struct BoolForward1;
template <bool B> struct BoolForward2;
template <bool B> struct BoolForward3;
template <bool B> struct BoolForward4;
template <bool B> struct BoolForward1 { void tt(){}; void ff(){}; };
template <bool B = true> struct BoolForward2 { void tt(){}; void ff(){}; };
template <bool B> struct BoolForward3 {};
template <> struct BoolForward3<true> { void tt(){}; };
template <> struct BoolForward3<false> { void ff(){}; };
template <bool B = true> struct BoolForward4 { void tt(){}; };
template <> struct BoolForward4<false> { void ff(){}; };
}
%}
// Instantiated names are the same as C++ template name
%template(BoolForward1) Space::BoolForward1<true>;
%template(BoolForward2) Space::BoolForward2<true>;
%template(BoolForward3) Space::BoolForward3<true>;
%template(BoolForward4) Space::BoolForward4<true>;
// Instantiated names are not the same as C++ template name
%template(BoolForward1False) Space::BoolForward1<false>;
%template(BoolForward2False) Space::BoolForward2<false>;
%template(BoolForward3False) Space::BoolForward3<false>;
%template(BoolForward4False) Space::BoolForward4<false>;
// Two parameter templates
%inline %{
namespace Space {
template <int I, bool B> struct IntBool1 { void tt(){}; void ff(){}; };
template <int I, bool B = true> struct IntBool2 { void tt(){}; void ff(){}; };
template <int I, bool B> struct IntBool3 {};
template <int I> struct IntBool3<I, true> { void tt(){}; };
template <int I> struct IntBool3<I, false> { void ff(){}; };
template <int I, bool B = true> struct IntBool4 { void tt(){}; };
template <int I> struct IntBool4<I, false> { void ff(){}; };
}
%}
// Instantiated names are the same as C++ template name
%template(IntBool1) Space::IntBool1<0, true>;
%template(IntBool2) Space::IntBool2<0, true>;
%template(IntBool3) Space::IntBool3<0, true>;
%template(IntBool4) Space::IntBool4<0, true>;
// Instantiated names are not the same as C++ template name
%template(IntBool1False) Space::IntBool1<0, false>;
%template(IntBool2False) Space::IntBool2<0, false>;
%template(IntBool3False) Space::IntBool3<0, false>;
%template(IntBool4False) Space::IntBool4<0, false>;
%{
namespace Space {
template <bool B> struct Duplicate1 { void ff(){}; };
}
%}
%warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate1;
namespace Space {
template <bool B> struct Duplicate1 { void ff(){}; };
template <bool B> struct Duplicate1 { void ff(){}; };
}
%warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate2;
%inline %{
namespace Space {
template <int I> struct Duplicate2 { void n(){}; };
}
%}
%template(Duplicate2_0) Space::Duplicate2<0>;
%template(Duplicate2_0) Space::Duplicate2<0>;
%warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate3;
%inline %{
namespace Space {
template <int I> struct Duplicate3 { void n(){}; };
}
%}
%template(Duplicate3) Space::Duplicate3<0>;
%template(Duplicate3) Space::Duplicate3<0>;
%{
namespace Space {
template <bool B> struct Duplicate4 { void ff(){}; };
}
%}
%warnfilter(SWIGWARN_PARSE_REDEFINED) Space::Duplicate4;
namespace Space {
template <bool B> struct Duplicate4 { void ff(){}; };
template <bool B> struct Duplicate4 { void ff(){}; };
}
%template(Duplicate4) Space::Duplicate4<0>;
%template(Duplicate4) Space::Duplicate4<0>;
|