Boost logo

Boost Users :

Subject: [Boost-users] Exposing std::pair to Python
From: A B (python6009_at_[hidden])
Date: 2009-04-15 20:50:13


Hi,

I am wondering if anyone has a working example of exposing std::pair
as a Python tuple or list. Technically, I need to expose a vector of
tuples and the following works

class_<std::vector<std::pair<std::string, double> > >("VectorPair")
    .def(vector_indexing_suite<std::vector<std::pair<std::string, double> > >())
    ;

but I am not sure how then to expose the std::pair. I am guessing I
should use boost/python/tuple.hpp or list.hpp but can't figure out
the syntax.

Thanks in advance.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net