PageRenderTime 32ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/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
  1. %module template_specialization
  2. %rename(not1) *::operator!() const;
  3. %rename(negate) *::operator-() const;
  4. %inline %{
  5. namespace vfncs {
  6. template <class ArgType>
  7. struct UnaryFunction
  8. {
  9. UnaryFunction operator-() const { return *this; }
  10. };
  11. template <>
  12. struct UnaryFunction<bool>
  13. {
  14. // This works
  15. // UnaryFunction<bool> operator!() const;
  16. // This doesn't
  17. UnaryFunction operator!() const { return *this; }
  18. // Does this?
  19. void foo(UnaryFunction) { }
  20. };
  21. }
  22. %}
  23. namespace vfncs {
  24. %template(UnaryFunction_double) UnaryFunction<double>;
  25. %template(UnaryFunction_bool) UnaryFunction<bool>;
  26. }