|
Boost.PythonResultConverter Concept |
A ResultConverter for a type T
is a type whose
instances can be used to convert C++ return values of type
T
to_python
. A ResultConverterGenerator is
an MPL unary metafunction class which, given the return type of a C++
function, returns a ResultConverter for that type. ResultConverters in
Boost.Python generally inspect library's registry of converters to
find a suitable converter, but converters which don't use the registry
are also possible.
In the table below, C
denotes a ResultConverter
type for a type R
, c
denotes
an object of type C
, and r
denotes an object of type R
.
Expression | Type | Semantics |
C c; |
Constructs a C object.
| |
c.convertible() |
convertible to bool |
false iff no conversion from any R value
to a Python object is possible. |
c(r) |
convertible to PyObject* |
A pointer to a Python object corresponding to r ,
or 0 iff r could not be converted
to_python , in which case PyErr_Occurred
should return non-zero. |
c.get_pytype() |
PyTypeObject const* |
A pointer to a Python Type object corresponding to result of the conversion,
or 0 . Used for documentation generation. If 0 is returned
the generated type in the documentation will be object . |
In the table below, G
denotes a
ResultConverterGenerator type and R
denotes a possible
C++ function return type.
Expression | Requirements |
G::apply<R>::type |
A ResultConverter type for R . |
Revised 09 May, 2002
© Copyright Dave Abrahams 2002.
Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.