3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-27 06:43:40 +01:00
dft_tools/triqs/python_tools/boost_object.hpp
Olivier Parcollet f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00

22 lines
478 B
C++

#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); }
};
}}