I have a boost::multi_index
with a hashed_non_unique
view. What I would like to accomplish is, given a key in that view, use
pair<myIter, myIter> iterRange = myView.equal_range(key);
for (myIter iter = iterRange.first; iter != iterRange.second; ++iter) {
// ...
}
to find all elements associated with that key. Then, run these elements through a filter
bool filter(Element e) { /* some filtering logic*/ }
and modify the filtered results with a modifier
void modifier(Element e) { /* modify the elements with e.g. myView.modify() */ }
However, simply putting these pieces together doesn't work since modifying the elements results in reordering of the multi_index, which renders my iterRange invalid.
What would be the correct way to do this? Thanks!