If I use erase for a key that does not exist in the map, is it a problem or the function does not do anything and returns harmlessly?
For example
map.erase('b') where 'b' is not contained in the map. What will it do?
/**
* @brief Erases elements according to the provided key.
* @param x Key of element to be erased.
* @return The number of elements erased.
*
* This function erases all the elements located by the given key from
* a %map.
* Note that this function only erases the element, and that if
* the element is itself a pointer, the pointed-to memory is not touched
* in any way. Managing the pointer is the user's responsibilty.
*/
size_type
erase(const key_type& __x)
{ return _M_t.erase(__x); }
No I am just saying will it give an error when I call remove. I want to remove some key if it is in the map and not worry about it if it not in the map.Will erase accomplish that or first I should serach in the map and erase only if they key is found?