Merge branch '0.8' to sync with changes made after 0.8.1 release.
[luabind.git] / doc / adopt.rst
bloba093642fe242a16945859ad56162a3ff25e84d1d
1 adopt
2 ----------------
4 Motivation
5 ~~~~~~~~~~
7 Used to transfer ownership across language boundaries.
9 Defined in
10 ~~~~~~~~~~
12 .. parsed-literal::
14     #include <luabind/adopt_policy.hpp>
16 Synopsis
17 ~~~~~~~~
19 .. parsed-literal::
21     adopt(index)
23 Parameters
24 ~~~~~~~~~~
26 ============= ===============================================================
27 Parameter     Purpose
28 ============= ===============================================================
29 ``index``     The index which should transfer ownership, ``_N`` or ``result``
30 ============= ===============================================================
32 Example
33 ~~~~~~~
35 .. parsed-literal::
37     X* create()
38     {
39         return new X;
40     }
42     ...
44     module(L)
45     [
46         def("create", &create, **adopt(result)**)
47     ];