The STL multiset represents an arbitrary collection of elements that can be queried for membership. multiset is useful in situations where you need to keep track of a collection of elements and must rapidly look up whether an element is contained.
The multiset allows for duplicates. For a similar container where duplicates are not allowed, use the set.
By default, the multiset uses operator < to order the elements behind the scenes. To use an alternative comparison function, parametrize the multiset as multiset<T, CompareFunctorType>.
multiset.Constructs a new multiset. This is the default constructor.
Inserts new elements into the multiset. The first version of insert inserts a single element into the multiset. insert returns a pair<iterator, bool>, where the first field of the pair is an iterator to the element and the second field is a bool that is always true.
The second version of this function inserts a range of elements into the multiset.
Returns an iterator to the specified element, if it exists, and the result of the multiset's end function otherwise. Note that there may be other values in the multiset with the same value; to obtain them all, use equal_range.
Returns two iterators delineating all elements with the specified value. If the value isn't contained in the multiset, the two iterators will be equal.
Returns the number of instances of the specified element in the multiset.
multisetRemoves elements from the multiset. The first version removes the specified element from the multiset, returning the number of elements removed. The second version removes from the multiset the element pointed at by the specified iterator. The third version removes all elements in the range [start, stop) from the multiset.
Returns whether the multiset is empty. It's considered good practice to call empty to determine whether the multiset is empty rather than checking whether size() returns zero.
Removes all elements from the multiset.
Returns the number of elements stored in the multiset.
Returns an iterator to the first element in the multiset. Elements in a multiset are stored in sorted order, so the elements returned by iterating over the multiset will be sorted.
Returns an iterator to the element one past the end of the multiset. This iterator does not point to a valid element, so do not dereference it.
multisetmultisetConstructs a new multiset whose elements are equal to the elements defined in the range [begin, end). These iterators need not come from another multiset.
Returns an iterator to the first element greater than or equal to the parameter. If no elements are found, lower_bound returns end().
Returns an iterator to the first element that compares strictly greater than the parameter.
Returns the maximum number of elements the multiset can hold, which is usually the number of unique memory addresses divided by the size of the elements stored in the container.
Returns the multiset's internal comparison function used to compare two elements. You can use this function to compare two elements in the same way as the multiset.
This function is identical to key_comp.
Returns a reverse_iterator to the last element of the multiset. reverse_iterators are like regular iterators except that they traverse in the opposite direction. Check for the end-of-container condition of reverse_iterators with rend.
Returns a reverse_iterator to the element one element before the start of the array. Like end, the iterator returned by rend does not actually reference a real element of the multiset and you should take care not to actually dereference it.
multisetssExchanges the contents of this multiset and another multiset.