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 133
|
%module template_parameters_global_scope
%inline %{
namespace Alloc {
template<typename T> struct Rebind {
typedef int Integer;
};
}
%}
%inline %{
struct Bucket_ {};
typedef Bucket_ TDBucket;
typedef ::Bucket_ TDGlobalBucket;
%}
// Check 1: %template no unary scope operator
%template(RebindBucket) Alloc::Rebind< Bucket_ >;
%inline %{
Alloc::Rebind< Bucket_ >::Integer Bucket1() { return 1; }
Alloc::Rebind< ::Bucket_ >::Integer Bucket2() { return 2; }
Alloc::Rebind< TDBucket >::Integer Bucket3() { return 3; }
Alloc::Rebind< ::TDBucket >::Integer Bucket4() { return 4; }
Alloc::Rebind< TDGlobalBucket >::Integer Bucket5() { return 5; }
Alloc::Rebind< ::TDGlobalBucket >::Integer Bucket6() { return 6; }
%}
// Check 2: %template with unary scope operator
%inline %{
struct Spade {};
typedef Spade TDSpade;
typedef ::Spade TDGlobalSpade;
%}
%template(RebindSpade) Alloc::Rebind< ::Spade >;
%inline %{
Alloc::Rebind< Spade >::Integer Spade1() { return 1; }
Alloc::Rebind< ::Spade >::Integer Spade2() { return 2; }
Alloc::Rebind< TDSpade >::Integer Spade3() { return 3; }
Alloc::Rebind< ::TDSpade >::Integer Spade4() { return 4; }
Alloc::Rebind< TDGlobalSpade >::Integer Spade5() { return 5; }
Alloc::Rebind< ::TDGlobalSpade >::Integer Spade6() { return 6; }
%}
// Check 3: %template typedef no unary scope operator
%inline %{
struct Ball {};
typedef Ball TDBall;
typedef ::Ball TDGlobalBall;
%}
%template(RebindBall) Alloc::Rebind< TDBall >;
%inline %{
Alloc::Rebind< Ball >::Integer Ball1() { return 1; }
Alloc::Rebind< ::Ball >::Integer Ball2() { return 2; }
Alloc::Rebind< TDBall >::Integer Ball3() { return 3; }
Alloc::Rebind< ::TDBall >::Integer Ball4() { return 4; }
Alloc::Rebind< TDGlobalBall >::Integer Ball5() { return 5; }
Alloc::Rebind< ::TDGlobalBall >::Integer Ball6() { return 6; }
%}
// Check 4: %template typedef with unary scope operator
%inline %{
struct Bat {};
typedef Bat TDBat;
typedef ::Bat TDGlobalBat;
%}
%template(RebindBat) Alloc::Rebind< ::TDBat >;
%inline %{
Alloc::Rebind< Bat >::Integer Bat1() { return 1; }
Alloc::Rebind< ::Bat >::Integer Bat2() { return 2; }
Alloc::Rebind< TDBat >::Integer Bat3() { return 3; }
Alloc::Rebind< ::TDBat >::Integer Bat4() { return 4; }
Alloc::Rebind< TDGlobalBat >::Integer Bat5() { return 5; }
Alloc::Rebind< ::TDGlobalBat >::Integer Bat6() { return 6; }
%}
// Check 5: %template double typedef no unary scope operator
%inline %{
struct Chair {};
typedef Chair TDChair;
typedef ::Chair TDGlobalChair;
%}
%template(RebindChair) Alloc::Rebind< TDGlobalChair >;
%inline %{
Alloc::Rebind< Chair >::Integer Chair1() { return 1; }
Alloc::Rebind< ::Chair >::Integer Chair2() { return 2; }
Alloc::Rebind< TDChair >::Integer Chair3() { return 3; }
Alloc::Rebind< ::TDChair >::Integer Chair4() { return 4; }
Alloc::Rebind< TDGlobalChair >::Integer Chair5() { return 5; }
Alloc::Rebind< ::TDGlobalChair >::Integer Chair6() { return 6; }
%}
// Check 6: %template double typedef with unary scope operator
%inline %{
struct Table {};
typedef Table TDTable;
typedef ::Table TDGlobalTable;
%}
%template(RebindTable) Alloc::Rebind< ::TDGlobalTable >;
%inline %{
Alloc::Rebind< Table >::Integer Table1() { return 1; }
Alloc::Rebind< ::Table >::Integer Table2() { return 2; }
Alloc::Rebind< TDTable >::Integer Table3() { return 3; }
Alloc::Rebind< ::TDTable >::Integer Table4() { return 4; }
Alloc::Rebind< TDGlobalTable >::Integer Table5() { return 5; }
Alloc::Rebind< ::TDGlobalTable >::Integer Table6() { return 6; }
%}
#if 0
%inline %{
namespace Alloc {
template<typename T=::Spade/*, typename T2=TDSpade, typename T3=::TDSpade, typename T4=TDGlobalSpade, typename T5=::TDGlobalSpade*/> struct Rejig {
typedef int Integer;
};
}
%}
%template(RejigSpade) Alloc::Rejig<::Spade>;
%inline %{
Alloc::Rejig<>::Integer rejig1() { return 1; }
Alloc::Rejig< ::Spade >::Integer rejig2() { return 2; }
Alloc::Rejig< ::TDSpade >::Integer rejig3() { return 3; }
Alloc::Rejig< ::TDSpade >::Integer rejig4() { return 4; }
Alloc::Rejig< TDGlobalSpade >::Integer rejig5() { return 5; }
Alloc::Rejig< ::TDGlobalSpade >::Integer rejig6() { return 6; }
%}
#endif
|