Joaquín Mª López Muñoz wrote:
The two snippets of code you show are entirely equivalent, in the sense that Present inherits the functionality of its first index, YIndex. In particular YIndex::iterator is the *same type* as Present::iterator, so I'm puzzled by the fact that you're observing different behaviors --from the code you're showing, using one or the other variation cannot possibly make any difference whatsoever. Could you please check your code for some other differences you might have not noticed when doing the switch from one version to the other?
Thanks for this information. The two code snippets were not equivalent because I was only using the iterator returned from the multi_index container's erase method in the one using YIndex::iterators. I have found that this iterator doesn't point to an element in the container. Instead its pointing to some memory that is zeroed. Prior to erasing the element I inserted some test code that looks though the entire container and doesn't find such an element. Given my constructor, this only makes sense. Do you have an explanation?