Today's top tip: You might think that you're avoiding memory problems by using l...

@JdeBP@tty0.social

Today's top tip:

You might think that you're avoiding memory problems by using list, map, and shared_ptr and doing things the Modern C++ way.

But if you're accidentally holding a short-lived reference to the front() of a list with non-pointer elements, over a call to code that erases something from the list, you are not. (-:

Interestingly, I couldn't persuade #valgrind to recognize that there was a use of a deallocated object problem.

#CPlusPlus #cpp