|
Boost Users : |
Subject: [Boost-users] Wrapper to C++ Lists using Python Boost
From: Kv Gopalkrishnan (kvgopalkrishnan1_at_[hidden])
Date: 2014-07-09 09:14:04
Hi all
I am relatively new to python boost and am trying to wrap a list
of pairs using an iterator.
In the Public section I have
namespace sky{
class FindNextMask{
public:
FindNextMask() {};
FindNextMask(int i):iter(i){}
bool operator()(const pair<int,string>& p)const{
if (iter <= p.first)
return true;
else
return false;
}
private:
int iter;
};
Then in another class say S
class S {
private:
list<pair<int,string> > A;
}
I am unable to find a solution to this. Any help in this context would be
appreciated. I know to write wrappers for pairs and vectors but I do not
understand how to extend this to C++ lists and connect it with iterators
and operators.
class_<std::vector<std::pair<double, double> > >("VectorOfPairs")
.def(vector_indexing_suite<std::vector<std::pair<double,double>
> >());
class_<std::pair<double, double> >("DoublePair") // Wrapper for a pair only
.def_readwrite("first", &std::pair<double, double>::first)
.def_readwrite("second", &std::pair<double, double>::second);
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