###

# Boost.Python

## ResultConverter Concept

Introduction
Concept Requirements

ResultConverter Concept
ResultConverterGenerator Concept

## Introduction

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.

## Concept Requirements

### ResultConverter Concept

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.

### ResultConverterGenerator Concept

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.