Reputation: 307
I am trying to add / delete values from a hashmap I created and stored into a void pointer. However the code I have for adding values seems to give me this error: "Unhandled exception at 0x75B5C41F in Project1.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0027F7C0."
The code for this: http://pastebin.com/FPzz05rU So what did I do wrong here and how can I fix it?
More information can be provided if needed.
Upvotes: 0
Views: 861
Reputation: 128
On this line,
map->at(key).push_back(value);
there is no vector at the key that you provide, so hash_map::at is throwing an std::out_of_range exception. Unlike hash_map::[], hash_map::at does not create a new element in the map if it does not already exist.
Upvotes: 1