]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [section boost/python/to_python_value.hpp] |
2 | [section Introduction] | |
3 | `to_python_value` is a model of [link concepts.resultconverter ResultConverter] which copies its argument into a new Python object. | |
4 | [endsect] | |
5 | [section Class template `to_python_value`] | |
6 | `` | |
7 | namespace boost { namespace python | |
8 | { | |
9 | template <class T> | |
10 | struct to_python_value | |
11 | { | |
12 | typedef typename add_reference< | |
13 | typename add_const<T>::type | |
14 | >::type argument_type; | |
15 | ||
16 | static bool convertible(); | |
17 | PyObject* operator()(argument_type) const; | |
18 | }; | |
19 | }} | |
20 | `` | |
21 | [endsect] | |
22 | [section Class `to_python_value` observers] | |
23 | ``static bool convertible();`` | |
24 | [variablelist | |
25 | [[Returns][`true` iff a converter has been registered which can convert `T` to python by-value. ]] | |
26 | ] | |
27 | ``PyObject* operator()(argument_type x) const;`` | |
28 | [variablelist | |
29 | [[Requires][`convertible() == true`]] | |
30 | [[Effects][converts `x` to python]] | |
31 | [[Returns][the resulting Python object iff a converter for `T` has been registered, `0` otherwise. ]] | |
32 | ] | |
33 | [endsect] | |
34 | [endsect] |