In std::multiset is there a function or algorithm to erase just one sample (unicate or duplicate) if an element is found

auto itr = my_multiset.find(value);
if(itr!=my_multiset.end()){
    my_multiset.erase(itr);
}

I would imagine there is a cleaner way of accomplishing the same. But this gets the job done.


Try this one:

multiset<int> s;
s.erase(s.lower_bound(value));

As long as you can ensure that the value exists in the set. That works.