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

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

#
Swig | 44 lines | 34 code | 10 blank | 0 comment | 0 complexity | d036eae6c625b7ad747d86f2332d45de MD5 | raw file
 1%module template_extend_overload
 2
 3
 4%inline %{
 5  template <class T>
 6    struct A
 7    {
 8    };
 9
10  template <class Arg, class Res>
11    struct B
12    {
13    };
14%}
15
16
17%define __compose_unary(Class, ArgType, ResType)
18  Class<ResType> compose(const B<ArgType, ResType>& f)
19  {
20    return Class<ResType>();
21  }
22%enddef
23
24%define __compose_unary_3(Class, Type)
25%extend Class<Type>
26{
27  __compose_unary(Class, Type, bool);
28  __compose_unary(Class, Type, double);
29  __compose_unary(Class, Type, int);
30}
31%enddef
32
33%define compose_unary(Class)
34  __compose_unary_3(Class, bool)
35  __compose_unary_3(Class, double)
36  __compose_unary_3(Class, int)
37%enddef
38
39compose_unary(A);
40  
41%template(A_double) A<double>;
42%template(A_int) A<int>;
43%template(A_bool) A<bool>;
44