/trunk/Examples/test-suite/template_specialization.i
Swig | 37 lines | 26 code | 11 blank | 0 comment | 0 complexity | 9cb76bf5bdcc74ef110cce9447e02ea1 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- %module template_specialization
- %rename(not1) *::operator!() const;
- %rename(negate) *::operator-() const;
- %inline %{
-
- namespace vfncs {
-
- template <class ArgType>
- struct UnaryFunction
- {
- UnaryFunction operator-() const { return *this; }
- };
- template <>
- struct UnaryFunction<bool>
- {
- // This works
- // UnaryFunction<bool> operator!() const;
- // This doesn't
- UnaryFunction operator!() const { return *this; }
- // Does this?
- void foo(UnaryFunction) { }
-
- };
-
- }
- %}
- namespace vfncs {
- %template(UnaryFunction_double) UnaryFunction<double>;
- %template(UnaryFunction_bool) UnaryFunction<bool>;
- }