/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
- %module "typename"
- // Tests the typename handling in templates.
- %inline %{
- class Foo {
- public:
- typedef double Number;
- Number blah() {
- return 2.1828;
- }
- };
- class Bar {
- public:
- typedef int Number;
- Number blah() {
- return 42;
- }
- };
- template<typename T> typename T::Number twoblah(T &obj) {
- return 2*(obj.blah());
- }
- Bar::Number spam() { return 3; }
- %}
- %template(twoFoo) twoblah<Foo>;
- %template(twoBar) twoblah<Bar>;
-