Boost logo

Boost Users :

From: Igor R (boost.lists_at_[hidden])
Date: 2008-06-12 13:58:54


Hi Joaquín,

> for(Entries::iterator
> it_key=entries.begin(),end=entries.end();it_key!=end;){
> // get all elements with key it_key->someForeignKey
> std::pair<Entries::iterator,Entries::iterator> values=
> entries.equal_range(it_key->someForeignKey);
> while(values.first!=values.second){
> // process element
> ++values.first;
> }
> // next key is just that of the element right after the current value
> group
> it_key=values.second;
> }

Thank you! It seems to be exactly what I need.
However, I'm not sure I got the principle right: how come that "next
key is just that of the element right after the current value"? Is
this the general behavior of equal_range - despite of the kind of the
index (ordered/hashed, unique/non-unique)?


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