3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 03:33:50 +01:00
dft_tools/triqs/python_tools/boost_object.hpp

22 lines
478 B
C++
Raw Normal View History

#include <Python.h>
#include <boost/python.hpp>
namespace triqs { namespace python_tools {
// A simple wrapper
class boost_object {
boost::python::handle<> hdl;
public:
boost_object(PyObject * py_ob) : hdl(boost::python::borrowed(py_ob)) {}
operator boost::python::object () { return boost::python::object(hdl); }
operator boost::python::list () { return boost::python::list(hdl); }
operator boost::python::dict () { return boost::python::dict(hdl); }
};
}}