Description

A unary function object type that acts a hash function for a Value. It takes a single argument of type Value and returns a value of type std::size_t.

Pred

A binary function object that implements an equivalence relation on values of type Value.
A binary function object that induces an equivalence relation on values of type Value.
It takes two arguments of type Value and returns a value of type bool.

Alloc

An allocator whose value type is the same as the container's value type.

The elements are organized into buckets. Keys with the same hash code are stored in the same bucket and elements with equivalent keys are stored next to each other.

The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.

unordered_multiset
public
types

typedeftypenameallocator_type::pointerpointer;

value_type* if
allocator_type::pointer is not defined.

typedeftypenameallocator_type::const_pointerconst_pointer;

boost::pointer_to_other<pointer, value_type>::type
if allocator_type::const_pointer is not defined.

typedefimplementation-definedsize_type;

An unsigned integral type.

size_type can represent any non-negative value of difference_type.

typedefimplementation-defineddifference_type;

A signed integral type.

Is identical to the difference type of iterator and const_iterator.

typedefimplementation-definediterator;

A constant iterator whose value type is value_type.

The iterator category is at least a forward iterator.

Convertible to const_iterator.

typedefimplementation-definedconst_iterator;

A constant iterator whose value type is value_type.

The iterator category is at least a forward iterator.

typedefimplementation-definedlocal_iterator;

An iterator with the same value type, difference type and pointer and reference type as iterator.

A local_iterator object can be used to iterate through a single bucket.

typedefimplementation-definedconst_local_iterator;

A constant iterator with the same value type, difference type and pointer and reference type as const_iterator.

A const_local_iterator object can be used to iterate through a single bucket.

Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.

If Allocator::select_on_container_copy_construction
exists and has the right signature, the allocator will be
constructed from its result.

Requires:

value_type is copy constructible

unordered_multiset(unordered_multiset&&);

The move constructor.

Notes:

This is implemented using Boost.Move.

Requires:

value_type is move constructible.

On compilers without rvalue reference support the
emulation does not support moving without calling
boost::move if value_type is
not copyable. So, for example, you can't return the
container from a function.

The destructor is applied to every element, and all memory is deallocated

unordered_multiset&operator=(unordered_multisetconst&);

The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.

If Alloc::propagate_on_container_copy_assignment
exists and Alloc::propagate_on_container_copy_assignment::value
is true, the allocator is overwritten, if not the
copied elements are created using the existing
allocator.

Requires:

value_type is copy constructible

unordered_multiset&operator=(unordered_multiset&&);

The move assignment operator.

If Alloc::propagate_on_container_move_assignment
exists and Alloc::propagate_on_container_move_assignment::value
is true, the allocator is overwritten, if not the
moved elements are created using the existing
allocator.

Notes:

On compilers without rvalue references, this is emulated using
Boost.Move. Note that on some compilers the copy assignment
operator may be used in some circumstances.

unordered_multiset iterators

An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.

iteratorend();const_iteratorend()const;

Returns:

An iterator which refers to the past-the-end value for the container.

const_iteratorcbegin()const;

Returns:

A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.

const_iteratorcend()const;

Returns:

A constant iterator which refers to the past-the-end value for the container.

unordered_multiset modifiers

template<typename... Args>iteratoremplace(Args&&... args);

Inserts an object, constructed with the arguments args, in the container.

Returns:

An iterator pointing to the inserted element.

Throws:

If an exception is thrown by an operation other than a call to hasher the function has no effect.

Notes:

Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.

Pointers and references to elements are never invalidated.

If the compiler doesn't support variadic template arguments or rvalue
references, this is emulated for up to 10 arguments, with no support
for rvalue references or move semantics.

Since existing std::pair implementations don't support
std::piecewise_construct this emulates it,
but using boost::unordered::piecewise_construct.

In version of Boost before 1.48 this emulated the variadic pair
constructor from older C++0x drafts. For backwards compatability
this can be enabled by defining the macro
BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT.

Inserts an object, constructed with the arguments args, in the container.

hint is a suggestion to where the element should be inserted.

Returns:

An iterator pointing to the inserted element.

Throws:

If an exception is thrown by an operation other than a call to hasher the function has no effect.

Notes:

The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value.

Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.

Pointers and references to elements are never invalidated.

If the compiler doesn't support variadic template arguments or rvalue
references, this is emulated for up to 10 arguments, with no support
for rvalue references or move semantics.

Since existing std::pair implementations don't support
std::piecewise_construct this emulates it,
but using boost::unordered::piecewise_construct.

In version of Boost before 1.48 this emulated the variadic pair
constructor from older C++0x drafts. For backwards compatability
this can be enabled by defining the macro
BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT.

iteratorinsert(value_typeconst& obj);

Inserts obj in the container.

Returns:

An iterator pointing to the inserted element.

Throws:

If an exception is thrown by an operation other than a call to hasher the function has no effect.

Notes:

Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.

Pointers and references to elements are never invalidated.

iteratorinsert(const_iterator hint,value_typeconst& obj);

Inserts obj in the container.

hint is a suggestion to where the element should be inserted.

Returns:

An iterator pointing to the inserted element.

Throws:

If an exception is thrown by an operation other than a call to hasher the function has no effect.

Notes:

The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value.

Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.

Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent value.

Throws:

When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.

Notes:

Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.

Pointers and references to elements are never invalidated.

iteratorerase(const_iterator position);

Erase the element pointed to by position.

Returns:

The iterator following position before the erasure.

Throws:

Only throws an exception if it is thrown by hasher or key_equal.

Notes:

In older versions this could be inefficient because it had to search
through several buckets to find the position of the returned iterator.
The data structure has been changed so that this is no longer the case,
and the alternative erase methods have been deprecated.

size_typeerase(key_typeconst& k);

Erase all elements with key equivalent to k.

Returns:

The number of elements erased.

Throws:

Only throws an exception if it is thrown by hasher or key_equal.

iteratorerase(const_iterator first,const_iterator last);

Erases the elements in the range from first to last.

Returns:

The iterator following the erased elements - i.e. last.

Throws:

Only throws an exception if it is thrown by hasher or key_equal.

In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.

voidquick_erase(const_iterator position);

Erase the element pointed to by position.

Throws:

Only throws an exception if it is thrown by hasher or key_equal.

In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.

Notes:

This method was implemented because returning an iterator to
the next element from erase was expensive, but
the container has been redesigned so that is no longer the
case. So this method is now deprecated.

voiderase_return_void(const_iterator position);

Erase the element pointed to by position.

Throws:

Only throws an exception if it is thrown by hasher or key_equal.

In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.

Notes:

This method was implemented because returning an iterator to
the next element from erase was expensive, but
the container has been redesigned so that is no longer the
case. So this method is now deprecated.

If Allocator::propagate_on_container_swap is declared and
Allocator::propagate_on_container_swap::value is true then the
containers' allocators are swapped. Otherwise, swapping with unequal allocators
results in undefined behavior.

Throws:

Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.

Notes:

The exception specifications aren't quite the same as the C++11 standard, as
the equality predieate and hash function are swapped using their copy constructors.

An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.

Notes:

The templated overloads are a non-standard extensions which
allows you to use a compatible hash function and equality
predicate for a key of a different type in order to avoid
an expensive type cast. In general, its use is not encouraged.

unordered_multiset swap

If Allocator::propagate_on_container_swap is declared and
Allocator::propagate_on_container_swap::value is true then the
containers' allocators are swapped. Otherwise, swapping with unequal allocators
results in undefined behavior.

Effects:

x.swap(y)

Throws:

Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.

Notes:

The exception specifications aren't quite the same as the C++11 standard, as
the equality predieate and hash function are swapped using their copy constructors.