Perhaps this is a duplicate but I did not find anything searching:
When erase(value)
is called on std::multiset
all elements with the value found are deleted. The only solution I could think of is:
std::multiset<int>::iterator hit(mySet.find(5));
if (hit!= mySet.end()) mySet.erase(hit);
This is ok but I thought there might be better. Any Ideas ?
Since C++17 (see here):
mySet.extract(val);