Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

boost/python/opaque_pointer_converter.hpp

Introduction
Class template opaque constructor
Macro BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee)

opaque<> registers itself as a converter from Python objects to pointers to undefined types and vice versa.

namespace boost { namespace python
{
    template<class Pointee>
    struct opaque
    {
        opaque();
    };
}}
opaque();

Effects
  • Registers the instance as a lvalue_from_pytype converter from Python objects into opaque pointers. The Python Objects created are named after the type pointed to by the opaque pointer being wrapped.
  • Registers the instance as a to_python_converter from opaque pointers to Python objects.
[Note] Note

If there is already an instance registered by another module, this instance doesn't try to register again in order to avoid warnings about multiple registrations.

This macro must be used to define specializations of the type_id function which can't be instantiated for incomplete types.

[Note] Note

The macro must be invoked in every translation unit which uses the opaque converter.


PrevUpHomeNext