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

# · Swig · 34 lines · 24 code · 10 blank · 0 comment · 0 complexity · 42c3512403b9bc08a499494676248b20 MD5 · raw file

  1. %module "typename"
  2. // Tests the typename handling in templates.
  3. %inline %{
  4. class Foo {
  5. public:
  6. typedef double Number;
  7. Number blah() {
  8. return 2.1828;
  9. }
  10. };
  11. class Bar {
  12. public:
  13. typedef int Number;
  14. Number blah() {
  15. return 42;
  16. }
  17. };
  18. template<typename T> typename T::Number twoblah(T &obj) {
  19. return 2*(obj.blah());
  20. }
  21. Bar::Number spam() { return 3; }
  22. %}
  23. %template(twoFoo) twoblah<Foo>;
  24. %template(twoBar) twoblah<Bar>;