Boost logo

Boost Users :

Subject: [Boost-users] How to Wrap a List of pairs with Python Boost
From: Kv Gopalkrishnan (kvgopalkrishnan1_at_[hidden])
Date: 2014-07-07 08:08:17


Hi all
        I am quiet new to python boost and am stuck with a problem with C++
STL lists.

I have a data type that is something like this

  list<pair<int,string> > gap_ls;

 Which is under the private section. I would like to wrap this like one can
do using a vector like this

 class_<std::vector<std::pair<double, double> > >("VectorOfPairs")

.def(vector_indexing_suite<std::vector<std::pair<double,double> >
>());

and for pairs I had this

        class_<std::pair<double, double> >("DoublePair")

                .def_readwrite("first", &std::pair<double, double>::first)

                .def_readwrite("second", &std::pair<double, double>::second);

But how do I write a wrapper for list<pair<int,string> >gap_ls;

Any advice in this context would be appreciated.

Kind Regards
K.V.



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