Suppose I know that a given std::multimap
has exactly one element with a given key and value, and I want to delete this element.
I could explicitly write a std::multimap::find
to find some element with that key, then walk backwards until I reach the first element with a different key, walk forward until I find the element I want, and delete it.
Question: Is there anything in <algorithm>
or elsewhere that will do this for me? Or do I have to write my own method?
EDIT: This is not the same question as STL Multimap Remove/Erase Values, which is about removing all elements with a given value.