/tags/ttn-post-libtool-1-4-3-upgrade/SWIG/Examples/test-suite/smart_pointer_overload.i
Swig | 24 lines | 19 code | 5 blank | 0 comment | 0 complexity | 9e7153912f9d077b12ca05ad27658bf7 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- %module smart_pointer_overload
- #ifndef SWIG_NO_OVERLOAD
- %inline %{
- struct Foo {
- int x;
- int test(int x) { x = 0; return 1; }
- int test(double x) { x = 0; return 2; }
- int test(char *s) { s = 0; return 3; }
- };
- class Bar {
- Foo *f;
- public:
- Bar(Foo *f) : f(f) { }
- Foo *operator->() {
- return f;
- }
- };
- %}
- #endif