Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-02-22 20:24:14


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

Should be something like (untested):

for( iterator it = m.lower_bound( make_pair( x, INT_MIN ) );
        it != m.end() && it->first.first == x; ++it )
{
    // do something with *it
}


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