|
Boost Users : |
From: Guillaume Lazzara (glazzara_at_[hidden])
Date: 2007-04-01 16:28:59
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<EquivSet::iterator, EquivSet::iterator> 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
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