Standard C++ Library Reference ISO/IEC (VERSION3)

iterator insert(const value_type& val);
iterator insert(iterator where, const value_type& val);
template<class InIt>
void insert(InIt first, InIt last);
iterator erase(iterator where);
iterator erase(iterator first, iterator last);
size_type erase(const Key& keyval);
void clear();
void swap(hash_multiset& right);
key_compare key_comp() const;
value_compare value_comp() const;
const_iterator find(const Key& keyval) const;
size_type count(const Key& keyval) const;
const_iterator lower_bound(const Key& keyval) const;
const_iterator upper_bound(const Key& keyval) const;
pair<const_iterator, const_iterator>
equal_range(const Key& keyval) const;
};
The template class describes an object that controls a varying-length sequence of elements of
type const Key. The sequence is ordered by the hash traits object Tr, which includes both a
two-operand function for imposing a strict weak ordering and a one-operand hash function.
Each element serves as both a sort key and a value. The sequence is represented in a way that
permits lookup, insertion, and removal of an arbitrary element with a number of operations that
can be independent of the number of elements in the sequence (constant time). In the worst
case, the number of operations is proportional to the number of elements in the sequence (linear
time). Moreover, inserting an element invalidates no iterators, and removing an element
invalidates only those iterators which point at the removed element.
The object orders the sequence it controls by calling a stored hash traits object of type Tr. You
access this stored object by calling the member function key_comp(). Such a traits object
must behave the same as an object of class hash_compare<Key, Pr>. Specifically, for all
values keyval of type Key, the call Tr(keyval) yields a distribution of values of type
size_t. Moreover, class Pr imposes a strict weak ordering on sort keys of type Key. For any
element X that precedes Y in the sequence and has the same hash value, key_comp()(Y, X)
is false. (For the default function object less<Key>, sort keys never decrease in value.)
Unlike template class hash_set, an object of template class hash_multiset does not
ensure that key_comp()(X, Y) is true. (Keys need not be unique.)
The actual order of elements in the controlled sequence depends on the hash function, the
ordering function, and the current size of the hash table stored in the container object. You
cannot determine the current size of the hash table, so you cannot in general predict the order of
elements in the controlled sequence. You can always be assured, however, that any subset of