/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

  1. %module smart_pointer_overload
  2. #ifndef SWIG_NO_OVERLOAD
  3. %inline %{
  4. struct Foo {
  5. int x;
  6. int test(int x) { x = 0; return 1; }
  7. int test(double x) { x = 0; return 2; }
  8. int test(char *s) { s = 0; return 3; }
  9. };
  10. class Bar {
  11. Foo *f;
  12. public:
  13. Bar(Foo *f) : f(f) { }
  14. Foo *operator->() {
  15. return f;
  16. }
  17. };
  18. %}
  19. #endif