
I am not sure how low_bound() will work. My understanding is it only return the ** first ** instance. but I am looking for ** all instances ** which fit the condition (i.e. the first value of the key pair matches the input parameter). --- Peter Dimov <pdimov@mmltd.net> wrote:
I have a map with key is a pair: typedef map < pair<int, int>, string>
Meryl Silverburgh wrote: pairMapString;
pair<int, int> key(1,3); map[key] = "one";
How can I create a binary function using boost
lamba which check the
first value of the pair of the key of the map?
void add(pairMapString;& myMap, int x) {
iterator& itr = find_if(myMap.begin(), myMap.end(), bind(equal_to < int >(),
bind(&BlockDataPairMap::value_type::first::value_type::first,
_1 ) ,
x) );
myMap.lower_bound( make_pair( x, INT_MIN ) ) should give you what you need in logarithmic time, if I'm not mistaken.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com