1 // Copyright Daniel Wallin 2007. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef OPTIONAL_070108_HPP
6 # define OPTIONAL_070108_HPP
8 # include <boost/python.hpp>
9 # include <boost/optional.hpp>
12 struct optional_to_python
16 boost::python::to_python_converter
<
17 boost::optional
<T
>, optional_to_python
<T
>
21 static PyObject
* convert(boost::optional
<T
> const& x
)
24 return boost::python::incref(Py_None
);
26 return boost::python::incref(boost::python::object(*x
).ptr());
30 #endif // OPTIONAL_070108_HPP