/trunk/Examples/test-suite/template_default_class_parms.i
Swig | 33 lines | 29 code | 4 blank | 0 comment | 0 complexity | b4349a01fa1ab386f8217a20de65c113 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- %module template_default_class_parms
- %inline %{
- namespace Space {
- struct SomeType {};
- struct AnotherType {};
- template<typename C, typename D = SomeType, typename E = int> class Bar {
- public:
- C CType;
- D DType;
- E EType;
- Bar(C c, D d, E e) {}
- C method(C c, D d, E e) { return c; }
- };
- template<typename T = SomeType> class Foo {
- public:
- T TType;
- Foo(T t) {}
- T method(T t) { return t; }
- };
- template<typename T = int> class ATemplate {};
- }
- %}
- // Use defaults
- %template(DefaultBar) Space::Bar<double>;
- %template(DefaultFoo) Space::Foo<>;
- // Don't use all defaults
- %template(BarAnotherTypeBool) Space::Bar<Space::AnotherType, bool>;
- %template(FooAnotherType) Space::Foo<Space::AnotherType>;
- %template() Space::ATemplate<>;