File: pure_out_value.rst

package info (click to toggle)
luabind 0.9.1%2Bdfsg-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,460 kB
  • sloc: cpp: 13,761; makefile: 120; sh: 24; ansic: 11
file content (58 lines) | stat: -rwxr-xr-x 1,298 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
pure_out_value
----------------

Motivation
~~~~~~~~~~

This works exactly like ``out_value``, except that it will pass a
default constructed object instead of converting an argument from
Lua. This means that the parameter will be removed from the lua
signature.

Defined in
~~~~~~~~~~

.. parsed-literal::

    #include <luabind/out_value_policy.hpp>

Synopsis
~~~~~~~~

.. parsed-literal::

    pure_out_value(index, policies = none)


Parameters
~~~~~~~~~~

=============== =============================================================
Parameter       Purpose
=============== =============================================================
``index``       The index of the parameter to be used as an out parameter.
``policies``    The policies used internally to convert the out parameter
                to Lua. ``_1`` is used as the internal index.
=============== =============================================================

Example
~~~~~~~

Note that no values are passed to the calls to ``f1`` and ``f2``.

.. parsed-literal::

    void f1(float& val) { val = 10.f; }
    void f2(float\* val) { \*val = 10.f; }

    module(L)
    [
        def("f", &f, **pure_out_value(_1)**)
    ];

    Lua 5.0  Copyright (C) 1994-2003 Tecgraf, PUC-Rio
    > print(f1())
    10
    > print(f2())
    10