adopt.rst 780 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. adopt
  2. ----------------
  3. Motivation
  4. ~~~~~~~~~~
  5. Used to transfer ownership across language boundaries.
  6. Defined in
  7. ~~~~~~~~~~
  8. .. parsed-literal::
  9. #include <luabind/adopt_policy.hpp>
  10. Synopsis
  11. ~~~~~~~~
  12. .. parsed-literal::
  13. adopt(index)
  14. Parameters
  15. ~~~~~~~~~~
  16. ============= ===============================================================
  17. Parameter Purpose
  18. ============= ===============================================================
  19. ``index`` The index which should transfer ownership, ``_N`` or ``result``
  20. ============= ===============================================================
  21. Example
  22. ~~~~~~~
  23. .. parsed-literal::
  24. X* create()
  25. {
  26. return new X;
  27. }
  28. ...
  29. module(L)
  30. [
  31. def("create", &create, **adopt(result)**)
  32. ];