From 4e30fcdf4094a0c450cbe1918c2e12dd19eb58f2 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 19 Nov 2009 21:53:02 -0500 Subject: Many improvements to Ledger's Python bindings --- src/pyutils.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/pyutils.h') diff --git a/src/pyutils.h b/src/pyutils.h index a9e968e0..d8a46527 100644 --- a/src/pyutils.h +++ b/src/pyutils.h @@ -106,6 +106,26 @@ struct register_optional_to_python : public boost::noncopyable } }; +template +struct PairToTupleConverter +{ + static PyObject * convert(const std::pair& pair) { + return boost::python::incref + (boost::python::make_tuple(pair.first, pair.second).ptr()); + } +}; + +template +struct map_value_type_converter +{ + map_value_type_converter() { + boost::python::to_python_converter + >(); + } +}; + namespace boost { namespace python { // Use expr to create the PyObject corresponding to x -- cgit v1.2.3