C++ STL map::erase a non-existing key
Yes, in fact, std::map::erase()
returns a size_type which indicates the number of keys erased. Thus it returns 0 for nothing erased and 1 for something erased for a map.
This is perfectly fine, mymap.erase('D') will return 0 in this case.
See http://www.cplusplus.com/reference/stl/map/erase.html