/trunk/Examples/test-suite/conversion_ns_template.i
Swig | 76 lines | 63 code | 13 blank | 0 comment | 0 complexity | 3170b1506647e355f87fb02b28fcb294 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- %module conversion_ns_template
- %{
- namespace oss
- {
- struct Hi
- {
- Hi(){}
- Hi(int){}
- };
- enum Test {One, Two};
- template <Test>
- struct Foo {
- Foo(){}
- };
- template <Test T>
- struct Bar {
- Bar(){ }
- Bar(int){ }
-
- operator int() { return 0; }
- operator int&() { static int num = 0; return num; }
- operator Foo<T>() { return Foo<T>(); }
- operator Foo<T>&() { return *(new Foo<T>()); }
- };
- }
- %}
- namespace oss
- {
- enum Test {One, Two};
-
- // these works
- %ignore Hi::Hi();
- %rename(create) Hi::Hi(int);
- struct Hi
- {
- Hi();
- Hi(int);
- };
- template <Test>
- struct Foo {
- Foo();
- };
-
- // these works
- %rename(hello1) Bar<One>::operator int&();
- %ignore Bar<One>::operator int();
- %rename(hello2) Bar<One>::operator Foo<oss::One>&();
- %ignore Bar<One>::operator Foo<oss::One>();
-
- // these don't
- %ignore Bar<One>::Bar();
- %rename(Bar_create) Bar<One>::Bar(int);
-
- template <Test T>
- struct Bar {
- Bar();
- Bar(int);
- operator int();
- operator int&();
- operator Foo<T>();
- operator Foo<T>&();
- };
- }
-
- namespace oss
- {
- %template(Foo_One) Foo<One>;
- %template(Bar_One) Bar<One>;
- }