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

# · Swig · 33 lines · 26 code · 7 blank · 0 comment · 0 complexity · 617dae915e45b3b1230312455b270977 MD5 · raw file

  1. %module template_static
  2. %warnfilter(SWIGWARN_RUBY_WRONG_NAME) foo<int>; /* Ruby, wrong class name */
  3. %warnfilter(SWIGWARN_RUBY_WRONG_NAME) foo<double>; /* Ruby, wrong class name */
  4. %inline %{
  5. template<class T> class foo {
  6. public:
  7. static int test;
  8. };
  9. template<class T> int foo<T>::test = 0;
  10. %}
  11. %template(foo_i) foo<int>;
  12. %template(foo_d) foo<double>;
  13. %inline %{
  14. namespace toto {
  15. class Foo {
  16. public:
  17. template<class T>
  18. static double bar(int i) {
  19. return 1.0;
  20. }
  21. private:
  22. int i;
  23. };
  24. }
  25. %}
  26. %template(bar_double) toto::Foo::bar<double>;