Re:My favourite C++ footgun
by kaik on Tuesday June 22, 2021 @06:21PM
(#27597984)
I kid you not, I spent a full working day debugging this exact same issue (taking a pointer to a vector element, before adding more elements).
Very obvious if you understand how C++ and vectors work, yet it took me forever to realize, and it was miserable…
[ Parent
| on HN ]
Heh, you can run into this even if you understand how iterator invalidation works. Once you see the bug it's easy to understand, but finding it might not be…
> finding it might not be…
Valgrind memcheck is your friend.