23 Feb
2006
23 Feb
'06
12:26 a.m.
yinglcs2@yahoo.com wrote:
I am not sure how low_bound() will work. My understanding is it only return the ** first ** instance.
But so does find_if.
but I am looking for ** all instances ** which fit the condition (i.e. the first value of the key pair matches the input parameter).
Since a map is sorted by its key, you just need to proceed from the iterator lower_bound returns until you hit an element with .first != x (or end()). Anyway, ...
iterator& itr = find_if(myMap.begin(),
... you need to omit the reference here. iterator itr = find_if( ...