Perhaps your myMap is no longer available. For example, it could be a reference to a remote pointer, or, much more likely, a member variable of an already deleted class:
class MyClass { public: selfInsert(std::string myKey) { if(!myKey.empty()) { myMap[myKey] = this; } } private: std::map<std::string, myClass*> myMap; } int main() { MyClass *a = new MyClass(); delete a; a->selfInsert(); }
source share