PageRenderTime 27ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Swig | 34 lines | 24 code | 10 blank | 0 comment | 0 complexity | 42c3512403b9bc08a499494676248b20 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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>;