fixes bug where priorities where lost when force-rechecking.
[libtorrent.git] / bindings / python / src / optional.hpp
blob63138cc680f2d4465af604e1142ed0bab18b74d8
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>
11 template <class T>
12 struct optional_to_python
14 optional_to_python()
16 boost::python::to_python_converter<
17 boost::optional<T>, optional_to_python<T>
18 >();
21 static PyObject* convert(boost::optional<T> const& x)
23 if (!x)
24 return boost::python::incref(Py_None);
26 return boost::python::incref(boost::python::object(*x).ptr());
30 #endif // OPTIONAL_070108_HPP