Why doesn’t Multiset allow to erase just one sample?
The reason lies in the official definition of the erase() method in std::multiset.
size_type erase (const value_type& val);
where val is the Value to be removed from the multiset. All elements with a value equivalent to this are removed from the container.
So if you use a value as a parameter in the erase() function in a multiset, then all elements having same value than this passed value will be erased.
GFact | How to erase just one sample in std::multiset
In std::multiset is there a function or algorithm to erase just one sample (unicate or duplicate) if an element is found? Curious to know the answer? This GFact will help you do just that.
But first, let us quickly understand what is a multiset.
Contact Us