Objects created dynamically by the new keyword while being referenced (stored) as pointers in STL containers (e.g. std::map, std::unordered_map, std::vector) are not being itself a subject of clearing/erasing done by the container (their destructor would not be triggered).
In this case you need to chose among:
to call explicitly delete on such pointer to delete the object, then remove the pointer entry from the container,
to use some smart pointer from the standard library unique_ptr/shared_ptr,
Hello, I can see some C++ STL misconception in usage in the code.
https://github.com/PotatoOfDoom/CyberFSR2/blob/main/CyberFSR/CyberFsr.cpp#L29
Objects created dynamically by the
new
keyword while being referenced (stored) as pointers in STL containers (e.g.std::map
,std::unordered_map
,std::vector
) are not being itself a subject of clearing/erasing done by the container (their destructor would not be triggered).In this case you need to chose among:
delete
on such pointer to delete the object, then remove the pointer entry from the container,unique_ptr
/shared_ptr
,reference (address) invalidation
cases for this specific STL container - https://stackoverflow.com/questions/6438086/iterator-invalidation-rules-for-c-containers,unordered_map
seems to fit forContexts
, but not for pointers, but objects directly.https://stackoverflow.com/a/383084/12755962