Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-02-22 19:26:45


yinglcs2_at_[hidden] 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( ...


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