- https://github.com/tiger40490/repo1/blob/cpp1/cpp1/linkedList/3waySorterLinkList_FB.cpp showing list erase during iteration
- deque/vector erase() while iterating #demo
- erase while reverse iteration: map,list #noIV
I had multiple encounters with STL iterator invalidation, esp. after erase().
- sometimes I get correct result
- sometimes I get segfault
- sometimes I get incorrect result
Opaque i.e. no obvious clues, so no keyword to google
Luckily my code was 20-lines
Luckily i could reproduce it once a while.
This is another example of tough bugs to hunt down.