Hi,
I'm currently using multi_index and I have few questions:
- I have a multi_index with composed keys, sometimes I need to get a
range of items, iterate over them and modify their key. How can I do
this properly?
sample code:
EquivSet::iterator tmp;
std::pair es =
contains.equal_range(*it);
for (EquivSet::iterator it_equiv = es.first; it_equiv != es.second;)
if (!X[it_equiv->id])
{
tmp = it_equiv++;
contains.modify_key(tmp, update_equiv(nbEns));
}
else
it_equiv++;
In this example, the second iterator in the pair, normaly used as end
iterator, can be changed and, sometimes, the loop iterates beyond the
latter.
- If I can choose between a std::set and a multi_index used as a set,
which one should I use?
Thank you very much for your answers!
--
Guillaume Lazzara
Epita CSI 2008