###

# Boost.Python

## Header <boost/python/default_call_policies.hpp>

## Contents

Classes
  Class `default_call_policies`
    Class `default_call_policies` synopsis
    Class `default_call_policies` static functions
  Class `default_result_converter`
    Class `default_result_converter` synopsis
    Class `default_result_converter` metafunctions
Example

## Classes

### Class `default_call_policies`

`default_call_policies` is a model of CallPolicies with no `precall` or `postcall` behavior and a `result_converter` which handles by-value returns. Wrapped C++ functions and member functions use `default_call_policies` unless otherwise specified. You may find it convenient to derive new models of CallPolicies from `default_call_policies`.

#### Class `default_call_policies` synopsis

    namespace boost { namespace python
    {
        struct default_call_policies
        {
            static bool precall(PyObject*);
            static PyObject* postcall(PyObject*, PyObject* result);
            typedef default_result_converter result_converter;
        };
    }}

#### Class `default_call_policies` static functions

    bool precall(PyObject*);

Returns: `true`
Throws: nothing

    PyObject* postcall(PyObject*, PyObject* result);

Returns: `result`
Throws: nothing

### Class `default_result_converter`

`default_result_converter` is a model of ResultConverterGenerator which can be used to wrap C++ functions returning non-pointer types, `char const*`, and `PyObject*`, by-value.

#### Class `default_result_converter` synopsis

    namespace boost { namespace python
    {
        struct default_result_converter
        {
            template <class T> struct apply;
        };
    }}

#### Class `default_result_converter` metafunctions

    template <class T> struct apply

Requires: `T` is not a reference type. If `T` is a pointer type, `T` is `const char*` or `PyObject*`.
Returns: `typedef to_python_value<T const&> type;`

## Example

This example comes from the Boost.Python implementation itself. Because the return_value_policy class template does not implement `precall` or `postcall` behavior, its default base class is `default_call_policies`:

    template <class Handler, class Base = default_call_policies>
    struct return_value_policy : Base
    {
       typedef Handler result_converter;
    };

Revised 13 November, 2002

© Copyright Dave Abrahams 2002. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)