PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/template_specialization_defarg.i

#
Swig | 95 lines | 68 code | 27 blank | 0 comment | 0 complexity | ab8049037543cb83317368917658dd2e MD5 | raw file
 1%module template_specialization_defarg
 2
 3%inline %{
 4
 5  template <class A, class B = double>
 6    struct C
 7    {
 8    };
 9  
10  
11  template <class BB>
12    struct C<int , BB> 
13    {
14      int hi()
15      {
16	return 0;
17      }
18
19      C(int a)
20      {
21      }
22      
23    };
24  
25
26  template <class BB>
27    struct C<double , BB> 
28    {
29      int hello()
30      {
31	return 0;
32      }
33      
34      C(double a)
35      {
36      }
37      
38    };
39
40  template <class T>
41    struct Alloc 
42    {
43    };
44  
45
46  template <class T, class A = double >
47    struct D
48    {
49      D(int){}
50    };
51
52
53  template <>
54    struct D<double>
55    {
56      D(){}
57      int foo() { return 0; }
58    };
59  
60      
61  
62  template <class T, class A = Alloc<T> >
63    struct Vector
64    {
65      Vector(int){}
66    };
67
68
69  template <>
70    struct Vector<double>
71    {
72      Vector(){}
73      int foo() { return 0; }
74    };
75  
76      
77%}
78
79
80//
81// This works fine
82//
83%template(C_i) C<int, double>;
84
85//
86// This one fails
87//
88%template(C_dd) C<double,double>;
89%template(C_d) C<double>;
90
91%template(D_i) D<int>;
92%template(D_d) D<double>;
93
94%template(Vector_i) Vector<int>;
95%template(Vector_d) Vector<double, Alloc<double> >;