%module template_partial_specialization %inline %{ namespace One { template struct OneParm { void a() {} }; template struct OneParm { void b() {} }; template struct OneParm { void c() {} }; template struct OneParm { void d() {} }; template struct OneParm { void e() {} }; template <> struct OneParm { void f() {} }; template <> struct OneParm { void g() {} }; template <> struct OneParm { void h() {} }; template <> struct OneParm { void j() {} }; template <> struct OneParm { void k() {} }; template <> struct OneParm { void m() {} }; template <> struct OneParm { void n() {} }; } %} // partial specializations %template(A) One::OneParm; %template(B) One::OneParm; %template(C) One::OneParm; %template(D) One::OneParm; %template(E) One::OneParm; // explicit specializations %template(F) One::OneParm; %template(G) One::OneParm; %template(H) One::OneParm; // %template scope explicit specializations namespace One { %template(J) One::OneParm; %template(K) ::One::OneParm; } %template(M) ::One::OneParm; namespace One { %template(N) OneParm; } // %template scope partial specializations namespace One { %template(BB) One::OneParm; %template(BBB) ::One::OneParm; } %template(BBBB) ::One::OneParm; namespace One { %template(BBBBB) OneParm; } // non-exact match %template(B1) One::OneParm; %template(B2) One::OneParm; %template(B3) One::OneParm; %template(B4) One::OneParm; // Two parameter specialization tests %inline %{ struct Concrete {}; namespace Two { template struct TwoParm { void a() {} }; template struct TwoParm { void b() {} }; template struct TwoParm { void c() {} }; template struct TwoParm { void d() {} }; template struct TwoParm { void e() {} }; template struct TwoParm { void f() {} }; template <> struct TwoParm { void g() {} }; template <> struct TwoParm { void h() {} }; } %} namespace Two { %template(A_) TwoParm; %template(B_) TwoParm; %template(C_) TwoParm; %template(D_) TwoParm; %template(E_) TwoParm; %template(F_) TwoParm; %template(G_) TwoParm; %template(C1_) TwoParm; %template(C2_) TwoParm; } %template(C3_) Two::TwoParm; %template(C4_) ::Two::TwoParm; %template(B1_) ::Two::TwoParm; %template(E1_) Two::TwoParm; %template(E2_) Two::TwoParm; %template(H_) Two::TwoParm< ::Concrete, ::Concrete * >; // Many template parameters %inline %{ template struct FiveParm { void a() {} }; template struct FiveParm { void b() {} }; %} %template(FiveParm1) FiveParm; %inline %{ template struct ThreeParm; template struct ThreeParm { void a1() {} }; template struct ThreeParm { void a2() {} }; template struct ThreeParm { void a3() {} }; %} %template(ThreeParmInt) ThreeParm; #if 0 // TODO fix: %inline %{ //namespace S { template struct X { void a() {} }; template struct X { void b() {} }; // template<> struct X { void c() {} }; //} %} namespace AA { // thinks X is in AA namespace %template(X2) X; }; #endif #if 0 namespace Space { } template struct Vector { #ifdef SWIG %template() Space::VectorHelper; #endif void gook(T i) {} void geeko(double d) {} void geeky(int d) {} }; /* template struct Vector { }; */ //} %} %template(VectorIntPtr) Space::Vector; // should fail as Vector is in global namespace // is this a regression - no fails in 1.3.40 too // Note problem is removed by removing empty Space namespace!! #endif