|
Boost Users : |
From: Maitre Bart (maitrebart_at_[hidden])
Date: 2006-11-09 16:55:33
Suppose I have a map (m) and a sorted vector of strings (v).
The map's key is a string, and the map's value is foobar.
I wish to compare map's keys with the vector's values and detect if they all
match:
(*mit).first == *vit
and wish to do it with STL/Boost algo and functors.
So I am starting with this:
equal(m.begin(),
m.end(),
v.begin(),
boost::bind(std::equa_to<string>(),
std::select1st<std::pair<string,foobar> >(_1), _2));
I know 2 parameters are past to bind: *mit and *vit . However, before the
equality, I want to extract the key from the map iterator (i.e. (*mit).first)
before the comparison. That is this part I have difficulty to concretise.
Btw, is there any equivalent to select1st (SGI extension) in Boost?
Does anyone have any idea?
I must be close to the solution...
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