fix doc example typo
[boost.git] / boost / python / return_opaque_pointer.hpp
blobcf544d803095b128d08e4284b19dcf429c9b14d1
1 // Copyright Gottfried Ganßauge 2003.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 /*
6 * Generic Return value converter generator for opaque C++-pointers
7 */
8 # ifndef RETURN_OPAQUE_POINTER_HPP_
9 # define RETURN_OPAQUE_POINTER_HPP_
11 # include <boost/python/detail/prefix.hpp>
12 # include <boost/python/opaque_pointer_converter.hpp>
13 # include <boost/python/detail/force_instantiate.hpp>
14 # include <boost/python/to_python_value.hpp>
15 # include <boost/python/detail/value_arg.hpp>
16 # include <boost/mpl/assert.hpp>
18 namespace boost { namespace python {
20 namespace detail
22 template <class Pointee>
23 static void opaque_pointee(Pointee const volatile*)
25 force_instantiate(opaque<Pointee>::instance);
29 struct return_opaque_pointer
31 template <class R>
32 struct apply
34 BOOST_MPL_ASSERT_MSG( is_pointer<R>::value, RETURN_OPAQUE_POINTER_EXPECTS_A_POINTER_TYPE, (R));
36 struct type :
37 boost::python::to_python_value<
38 typename detail::value_arg<R>::type
41 type() { detail::opaque_pointee(R()); }
46 }} // namespace boost::python
47 # endif // RETURN_OPAQUE_POINTER_HPP_