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

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

#
Swig | 33 lines | 29 code | 4 blank | 0 comment | 0 complexity | b4349a01fa1ab386f8217a20de65c113 MD5 | raw file
 1%module template_default_class_parms
 2
 3%inline %{
 4namespace Space {
 5  struct SomeType {};
 6  struct AnotherType {};
 7  template<typename C, typename D = SomeType, typename E = int> class Bar {
 8  public:
 9    C CType;
10    D DType;
11    E EType;
12    Bar(C c, D d, E e) {}
13    C method(C c, D d, E e) { return c; }
14  };
15  template<typename T = SomeType> class Foo {
16  public:
17    T TType;
18    Foo(T t) {}
19    T method(T t) { return t; }
20  };
21  template<typename T = int> class ATemplate {};
22}
23%}
24
25// Use defaults
26%template(DefaultBar) Space::Bar<double>;
27%template(DefaultFoo) Space::Foo<>;
28
29// Don't use all defaults
30%template(BarAnotherTypeBool) Space::Bar<Space::AnotherType, bool>;
31%template(FooAnotherType) Space::Foo<Space::AnotherType>;
32
33%template() Space::ATemplate<>;