I am trying to do something like this:
auto& myIndex = myMultiIndex.get<0>();
auto range = myIndex.equal_range(x);
for (auto iter = range.first; iter != range.second; ++iter) {
if (somePredicate) myIndex.erase(iter);
}
Of course this does not work because the iterator becomes invalid once we erase an element from the container. Also std::remove_if doesn't work since it modifies and overwrites elements in the container which will mess up the other indices. What is the recommended way of doing something like this?
Thanks!