...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
\n | \n Boost.Python\n\nHeader\n <boost/python/default_call_policies.hpp>\n |
default_call_policies
default_call_policies
is a model of CallPolicies with no precall
or\n postcall
behavior and a result_converter
which\n handles by-value returns. Wrapped C++ functions and member functions use\n default_call_policies
unless otherwise specified. You may find\n it convenient to derive new models of CallPolicies from\n default_call_policies
.\n\n
default_call_policies
synopsis\nnamespace boost { namespace python\n{\n struct default_call_policies\n {\n static bool precall(PyObject*);\n static PyObject* postcall(PyObject*, PyObject* result);\n typedef default_result_converter result_converter;\n template <class Sig> struct extract_return_type : mpl::front<Sig>{};\n };\n}}\n\n\n
default_call_policies
static functions\nbool precall(PyObject*);\n\n\n
true
\n\n \nPyObject* postcall(PyObject*, PyObject* result);\n\n\n
result
\n\n default_result_converter
default_result_converter
is a model of ResultConverterGenerator which can be\n used to wrap C++ functions returning non-pointer types, char\n const*
, and PyObject*
, by-value.\n\n
default_result_converter
synopsis\nnamespace boost { namespace python\n{\n struct default_result_converter\n {\n template <class T> struct apply;\n };\n}}\n\n\n
default_result_converter
metafunctions\ntemplate <class T> struct apply\n\n\n \n\n
This example comes from the Boost.Python implementation itself. Because\n the return_value_policy\n class template does not implement precall
or\n postcall
behavior, its default base class is\n default_call_policies
:\n
\ntemplate <class Handler, class Base = default_call_policies>\nstruct return_value_policy : Base\n{\n typedef Handler result_converter;\n};\n\n\n
Revised \n \n 11 June, 2007\n \n\n\n
© Copyright Dave\n Abrahams 2002. Distributed under the Boost Software License,\n Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at\n http://www.boost.org/LICENSE_1_0.txt)
\n\n'