Absolutely, if you keep the pointer to the previous or next element, it is safe to remove an element. If you are in the process of completely emptying the hashtable you can just keep removing the head element.
George On Nov 18, 2016 6:51 AM, "Clement FOYER" <clement.fo...@gmail.com> wrote: > Hi everyone, > > I was wondering if it was possible to remove an element while iterating > over the elements of a hashtable. As saw that it wasn't while using the > OPAL_HASHTABLE_FOREACH macro, and I suppose it's because of the possible > loss of the current next element. But how about if the element have already > been iterated over? If I save a pointer to the previous element, it is safe > to remove it from the hashtable? > > Thank you, > > Clément FOYER > > _______________________________________________ > devel mailing list > devel@lists.open-mpi.org > https://rfd.newmexicoconsortium.org/mailman/listinfo/devel
_______________________________________________ devel mailing list devel@lists.open-mpi.org https://rfd.newmexicoconsortium.org/mailman/listinfo/devel