Boost logo

Boost Users :

From: yinglcs2_at_[hidden]
Date: 2006-02-22 20:17:06


Thanks. I would like to use your suggestion (since it
is simpler/cleaner).

however, you said 'you just need to
 proceed from the iterator
 lower_bound returns until you hit an element with
 .first != x (or end()). '

How can I find the element with .first != x?

I try using end(), but it does not work. it copies
evething from (.fires == x) to the end of the list.

--- Peter Dimov <pdimov_at_[hidden]> wrote:

> 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 mailing list
> Boost-users_at_[hidden]
>
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


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