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

# · Swig · 21 lines · 16 code · 5 blank · 0 comment · 0 complexity · f74f3f5910b155506bb32edf9e3c5e5c MD5 · raw file

  1. %module operator_pointer_ref
  2. %rename(AsCharStarRef) operator char*&;
  3. %inline %{
  4. class MyClass {
  5. public:
  6. MyClass (const char *s_ = "")
  7. : s(strdup(s_ ? s_ : ""))
  8. { }
  9. ~MyClass ()
  10. { free(s); }
  11. operator char*&()
  12. { return s; }
  13. private:
  14. char *s;
  15. };
  16. %}