boost::hash<Value>std::equal_to<Value>std::allocator<Value>
An unordered associative container that stores unique values.
Based on chapter 23 of
the working draft of the C++ standard [n2960].
But without the updated rules for allocators.
Template ParametersValueValue must be Assignable and CopyConstructibleHashA 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.PredA 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 Key.
It takes two arguments of type Key and returns a value of type bool.AllocAn 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.The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.ValueValueHashPredAlloctypename allocator_type::pointertypename allocator_type::const_pointertypename allocator_type::referencelvalue of value_type.typename allocator_type::const_referenceconst lvalue of value_type.implementation-definedAn unsigned integral type.size_type can represent any non-negative value of difference_type.implementation-definedA signed integral type.Is identical to the difference type of iterator and const_iterator.implementation-definedA constant iterator whose value type is value_type. The iterator category is at least a forward iterator.Convertible to const_iterator.implementation-definedA constant iterator whose value type is value_type. The iterator category is at least a forward iterator.implementation-definedAn 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.implementation-definedA 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.size_typeimplementation-definedhasher const&hasher()key_equal const&key_equal()allocator_type const&allocator_type()size() == 0Constructs 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.InputIteratorInputIteratorsize_typeimplementation-definedhasher const&hasher()key_equal const&key_equal()allocator_type const&allocator_type()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.unordered_set const&The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.value_type is copy constructibleunordered_set &&The move constructor.This is emulated on compilers without rvalue references.value_type is move constructible.
(TODO: This is not actually required in this implementation).
Allocator const&Constructs an empty container, using allocator a.unordered_set const&Allocator const&Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.The destructor is applied to every element, and all memory is deallocatedunordered_set const&unordered_set&The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.
On compilers without rvalue references, there is a single assignment
operator with the signature operator=(unordered_set)
in order to emulate move semantics.
value_type is copy constructibleunordered_set &&unordered_set&The move assignment operator.
On compilers without rvalue references, there is a single assignment
operator with the signature operator=(unordered_set)
in order to emulate move semantics.
value_type is move constructible.
(TODO: This is not actually required in this implementation).
allocator_typeboolsize() == 0size_typestd::distance(begin(), end())size_typesize() of the largest possible container.
iteratorconst_iteratorAn iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
iteratorconst_iteratorAn iterator which refers to the past-the-end value for the container.
const_iteratorA 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_iteratorA constant iterator which refers to the past-the-end value for the container.
Args&&std::pair<iterator, bool>Inserts an object, constructed with the arguments args, in the container if and only if there is no element in the container with an equivalent value.The bool component of the return type is true if an insert took place.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratorArgs&&iteratorInserts an object, constructed with the arguments args, in the container if and only if there is no element in the container with an equivalent value.hint is a suggestion to where the element should be inserted.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.value_type const&std::pair<iterator, bool>Inserts obj in the container if and only if there is no element in the container with an equivalent value.The bool component of the return type is true if an insert took place.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratorvalue_type const&iteratorInserts obj in the container if and only if there is no element in the container with an equivalent value.hint is a suggestion to where the element should be inserted.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.InputIteratorInputIteratorvoidInserts 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.When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratoriteratorErase the element pointed to by position.The iterator following position before the erasure.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.
When the number of elements is a lot smaller than the number of buckets
this function can be very inefficient as it has to search through empty
buckets for the next element, in order to return the iterator.
The method quick_erase is faster, but has yet
to be standardized.
key_type const&size_typeErase all elements with key equivalent to k.The number of elements erased.Only throws an exception if it is thrown by hasher or key_equal.const_iteratorconst_iteratoriteratorErases the elements in the range from first to last.The iterator following the erased elements - i.e. last.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.const_iteratorvoidErase the element pointed to by position.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.
This method is faster than erase as
it doesn't have to find the next element in the container -
a potentially costly operation.
As it hasn't been standardized, it's likely that this may
change in the future.
const_iteratorvoidErase the element pointed to by position.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.
This method is now deprecated, use
quick_return instead. Although be
warned that as that isn't standardized yet, it could also
change.
voidErases all elements in the container.size() == 0Never throws an exception.unordered_set&voidIf the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.For a discussion of the behavior when allocators aren't equal see
the implementation details.hasherThe container's hash function.
key_equalThe container's key equality predicate.
key_type const&iteratorkey_type const&const_iteratorCompatibleKey const&CompatibleHash const&CompatiblePredicate const&iteratorCompatibleKey const&CompatibleHash const&CompatiblePredicate const&const_iteratorAn iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.
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.
key_type const&size_typeThe number of elements with key equivalent to k.key_type const&std::pair<iterator, iterator>key_type const&std::pair<const_iterator, const_iterator>A range containing all elements with key equivalent to k.
If the container doesn't container any such elements, returns
std::make_pair(b.end(),b.end()).
size_typeThe number of buckets.size_typeAn upper bound on the number of buckets.size_typesize_typen < bucket_count()The number of elements in bucket n.key_type const&size_typeThe index of the bucket which would contain an element with key k.The return value is less than bucket_count()size_typelocal_iteratorsize_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A local iterator pointing the first element in the bucket with index n.size_typelocal_iteratorsize_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A local iterator pointing the 'one past the end' element in the bucket with index n.size_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A constant local iterator pointing the first element in the bucket with index n.size_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A constant local iterator pointing the 'one past the end' element in the bucket with index n.floatThe average number of elements per bucket.floatReturns the current maximum load factor.floatvoidChanges the container's maximum load factor, using z as a hint.size_typevoidChanges the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.unordered_set<Value, Hash, Pred, Alloc> const&unordered_set<Value, Hash, Pred, Alloc> const&boolThis is a boost extension.Behavior is undefined if the two containers don't have
equivalent equality predicates.unordered_set<Value, Hash, Pred, Alloc> const&unordered_set<Value, Hash, Pred, Alloc> const&boolThis is a boost extension.Behavior is undefined if the two containers don't have
equivalent equality predicates.unordered_set<Value, Hash, Pred, Alloc>&unordered_set<Value, Hash, Pred, Alloc>&voidx.swap(y)If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred.For a discussion of the behavior when allocators aren't equal see
the implementation details.boost::hash<Value>std::equal_to<Value>std::allocator<Value>
An unordered associative container that stores values. The same key can be stored multiple times.
Based on chapter 23 of
the working draft of the C++ standard [n2960].
But without the updated rules for allocators.
Template ParametersValueValue must be Assignable and CopyConstructibleHashA 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.PredA 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 Key.
It takes two arguments of type Key and returns a value of type bool.AllocAn 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.ValueValueHashPredAlloctypename allocator_type::pointertypename allocator_type::const_pointertypename allocator_type::referencelvalue of value_type.typename allocator_type::const_referenceconst lvalue of value_type.implementation-definedAn unsigned integral type.size_type can represent any non-negative value of difference_type.implementation-definedA signed integral type.Is identical to the difference type of iterator and const_iterator.implementation-definedA constant iterator whose value type is value_type. The iterator category is at least a forward iterator.Convertible to const_iterator.implementation-definedA constant iterator whose value type is value_type. The iterator category is at least a forward iterator.implementation-definedAn 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.implementation-definedA 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.size_typeimplementation-definedhasher const&hasher()key_equal const&key_equal()allocator_type const&allocator_type()size() == 0Constructs 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.InputIteratorInputIteratorsize_typeimplementation-definedhasher const&hasher()key_equal const&key_equal()allocator_type const&allocator_type()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.unordered_multiset const&The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.value_type is copy constructibleunordered_multiset &&The move constructor.This is emulated on compilers without rvalue references.value_type is move constructible.
(TODO: This is not actually required in this implementation).
Allocator const&Constructs an empty container, using allocator a.unordered_multiset const&Allocator const&Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.The destructor is applied to every element, and all memory is deallocatedunordered_multiset const&unordered_multiset&The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.
On compilers without rvalue references, there is a single assignment
operator with the signature operator=(unordered_multiset)
in order to emulate move semantics.
value_type is copy constructibleunordered_multiset &&unordered_multiset&The move assignment operator.
On compilers without rvalue references, there is a single assignment
operator with the signature operator=(unordered_multiset)
in order to emulate move semantics.
value_type is move constructible.
(TODO: This is not actually required in this implementation).
allocator_typeboolsize() == 0size_typestd::distance(begin(), end())size_typesize() of the largest possible container.
iteratorconst_iteratorAn iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
iteratorconst_iteratorAn iterator which refers to the past-the-end value for the container.
const_iteratorA 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_iteratorA constant iterator which refers to the past-the-end value for the container.
Args&&iteratorInserts an object, constructed with the arguments args, in the container.An iterator pointing to the inserted element.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratorArgs&&iteratorInserts an object, constructed with the arguments args, in the container.hint is a suggestion to where the element should be inserted.An iterator pointing to the inserted element.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.value_type const&iteratorInserts obj in the container.An iterator pointing to the inserted element.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratorvalue_type const&iteratorInserts obj in the container.hint is a suggestion to where the element should be inserted.An iterator pointing to the inserted element.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.InputIteratorInputIteratorvoidInserts a range of elements into the container.When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratoriteratorErase the element pointed to by position.The iterator following position before the erasure.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.
When the number of elements is a lot smaller than the number of buckets
this function can be very inefficient as it has to search through empty
buckets for the next element, in order to return the iterator.
The method quick_erase is faster, but has yet
to be standardized.
key_type const&size_typeErase all elements with key equivalent to k.The number of elements erased.Only throws an exception if it is thrown by hasher or key_equal.const_iteratorconst_iteratoriteratorErases the elements in the range from first to last.The iterator following the erased elements - i.e. last.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.const_iteratorvoidErase the element pointed to by position.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.
This method is faster than erase as
it doesn't have to find the next element in the container -
a potentially costly operation.
As it hasn't been standardized, it's likely that this may
change in the future.
const_iteratorvoidErase the element pointed to by position.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.
This method is now deprecated, use
quick_return instead. Although be
warned that as that isn't standardized yet, it could also
change.
voidErases all elements in the container.size() == 0Never throws an exception.unordered_multiset&voidIf the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.For a discussion of the behavior when allocators aren't equal see
the implementation details.hasherThe container's hash function.
key_equalThe container's key equality predicate.
key_type const&iteratorkey_type const&const_iteratorCompatibleKey const&CompatibleHash const&CompatiblePredicate const&iteratorCompatibleKey const&CompatibleHash const&CompatiblePredicate const&const_iteratorAn iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.
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.
key_type const&size_typeThe number of elements with key equivalent to k.key_type const&std::pair<iterator, iterator>key_type const&std::pair<const_iterator, const_iterator>A range containing all elements with key equivalent to k.
If the container doesn't container any such elements, returns
std::make_pair(b.end(),b.end()).
size_typeThe number of buckets.size_typeAn upper bound on the number of buckets.size_typesize_typen < bucket_count()The number of elements in bucket n.key_type const&size_typeThe index of the bucket which would contain an element with key k.The return value is less than bucket_count()size_typelocal_iteratorsize_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A local iterator pointing the first element in the bucket with index n.size_typelocal_iteratorsize_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A local iterator pointing the 'one past the end' element in the bucket with index n.size_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A constant local iterator pointing the first element in the bucket with index n.size_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A constant local iterator pointing the 'one past the end' element in the bucket with index n.floatThe average number of elements per bucket.floatReturns the current maximum load factor.floatvoidChanges the container's maximum load factor, using z as a hint.size_typevoidChanges the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.unordered_multiset<Value, Hash, Pred, Alloc> const&unordered_multiset<Value, Hash, Pred, Alloc> const&boolThis is a boost extension.Behavior is undefined if the two containers don't have
equivalent equality predicates.unordered_multiset<Value, Hash, Pred, Alloc> const&unordered_multiset<Value, Hash, Pred, Alloc> const&boolThis is a boost extension.Behavior is undefined if the two containers don't have
equivalent equality predicates.unordered_multiset<Value, Hash, Pred, Alloc>&unordered_multiset<Value, Hash, Pred, Alloc>&voidx.swap(y)If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred.For a discussion of the behavior when allocators aren't equal see
the implementation details.boost::hash<Key>std::equal_to<Key>std::allocator<std::pair<Key const, Mapped> >
An unordered associative container that associates unique keys with another value.
Based on chapter 23 of
the working draft of the C++ standard [n2960].
But without the updated rules for allocators.
Template ParametersKeyKey must be Assignable and CopyConstructible.MappedMapped must be CopyConstructibleHashA unary function object type that acts a hash function for a Key. It takes a single argument of type Key and returns a value of type std::size_t.PredA binary function object that implements an equivalence relation on values of type Key.
A binary function object that induces an equivalence relation on values of type Key.
It takes two arguments of type Key and returns a value of type bool.AllocAn 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.The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.Keystd::pair<Key const, Mapped>MappedHashPredAlloctypename allocator_type::pointertypename allocator_type::const_pointertypename allocator_type::referencelvalue of value_type.typename allocator_type::const_referenceconst lvalue of value_type.implementation-definedAn unsigned integral type.size_type can represent any non-negative value of difference_type.implementation-definedA signed integral type.Is identical to the difference type of iterator and const_iterator.implementation-definedA iterator whose value type is value_type. The iterator category is at least a forward iterator.Convertible to const_iterator.implementation-definedA constant iterator whose value type is value_type. The iterator category is at least a forward iterator.implementation-definedAn 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.implementation-definedA 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.size_typeimplementation-definedhasher const&hasher()key_equal const&key_equal()allocator_type const&allocator_type()size() == 0Constructs 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.InputIteratorInputIteratorsize_typeimplementation-definedhasher const&hasher()key_equal const&key_equal()allocator_type const&allocator_type()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.unordered_map const&The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.value_type is copy constructibleunordered_map &&The move constructor.This is emulated on compilers without rvalue references.value_type is move constructible.
(TODO: This is not actually required in this implementation).
Allocator const&Constructs an empty container, using allocator a.unordered_map const&Allocator const&Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.The destructor is applied to every element, and all memory is deallocatedunordered_map const&unordered_map&The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.
On compilers without rvalue references, there is a single assignment
operator with the signature operator=(unordered_map)
in order to emulate move semantics.
value_type is copy constructibleunordered_map &&unordered_map&The move assignment operator.
On compilers without rvalue references, there is a single assignment
operator with the signature operator=(unordered_map)
in order to emulate move semantics.
value_type is move constructible.
(TODO: This is not actually required in this implementation).
allocator_typeboolsize() == 0size_typestd::distance(begin(), end())size_typesize() of the largest possible container.
iteratorconst_iteratorAn iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
iteratorconst_iteratorAn iterator which refers to the past-the-end value for the container.
const_iteratorA 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_iteratorA constant iterator which refers to the past-the-end value for the container.
Args&&std::pair<iterator, bool>Inserts an object, constructed with the arguments args, in the container if and only if there is no element in the container with an equivalent key.The bool component of the return type is true if an insert took place.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratorArgs&&iteratorInserts an object, constructed with the arguments args, in the container if and only if there is no element in the container with an equivalent key.hint is a suggestion to where the element should be inserted.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.If an exception is thrown by an operation other than a call to hasher the function has no effect.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 key. 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.value_type const&std::pair<iterator, bool>Inserts obj in the container if and only if there is no element in the container with an equivalent key.The bool component of the return type is true if an insert took place.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratorvalue_type const&iteratorInserts obj in the container if and only if there is no element in the container with an equivalent key.hint is a suggestion to where the element should be inserted.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.If an exception is thrown by an operation other than a call to hasher the function has no effect.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 key. 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.InputIteratorInputIteratorvoidInserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent key.When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratoriteratorErase the element pointed to by position.The iterator following position before the erasure.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.
When the number of elements is a lot smaller than the number of buckets
this function can be very inefficient as it has to search through empty
buckets for the next element, in order to return the iterator.
The method quick_erase is faster, but has yet
to be standardized.
key_type const&size_typeErase all elements with key equivalent to k.The number of elements erased.Only throws an exception if it is thrown by hasher or key_equal.const_iteratorconst_iteratoriteratorErases the elements in the range from first to last.The iterator following the erased elements - i.e. last.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.const_iteratorvoidErase the element pointed to by position.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.
This method is faster than erase as
it doesn't have to find the next element in the container -
a potentially costly operation.
As it hasn't been standardized, it's likely that this may
change in the future.
const_iteratorvoidErase the element pointed to by position.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.
This method is now deprecated, use
quick_return instead. Although be
warned that as that isn't standardized yet, it could also
change.
voidErases all elements in the container.size() == 0Never throws an exception.unordered_map&voidIf the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.For a discussion of the behavior when allocators aren't equal see
the implementation details.hasherThe container's hash function.
key_equalThe container's key equality predicate.
key_type const&iteratorkey_type const&const_iteratorCompatibleKey const&CompatibleHash const&CompatiblePredicate const&iteratorCompatibleKey const&CompatibleHash const&CompatiblePredicate const&const_iteratorAn iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.
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.
key_type const&size_typeThe number of elements with key equivalent to k.key_type const&std::pair<iterator, iterator>key_type const&std::pair<const_iterator, const_iterator>A range containing all elements with key equivalent to k.
If the container doesn't container any such elements, returns
std::make_pair(b.end(),b.end()).
key_type const&mapped_type&If the container does not already contain an elements with a key equivalent to k, inserts the value std::pair<key_type const, mapped_type>(k, mapped_type())A reference to x.second where x is the element already in the container, or the newly inserted element with a key equivalent to kIf an exception is thrown by an operation other than a call to hasher the function has no effect.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.Mapped&key_type const&Mapped const&key_type const&A reference to x.second where x is the (unique) element whose key is equivalent to k.An exception object of type std::out_of_range if no such element is present.This is not specified in the draft standard, but that is probably an oversight. The issue has been raised in
comp.std.c++.size_typeThe number of buckets.size_typeAn upper bound on the number of buckets.size_typesize_typen < bucket_count()The number of elements in bucket n.key_type const&size_typeThe index of the bucket which would contain an element with key k.The return value is less than bucket_count()size_typelocal_iteratorsize_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A local iterator pointing the first element in the bucket with index n.size_typelocal_iteratorsize_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A local iterator pointing the 'one past the end' element in the bucket with index n.size_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A constant local iterator pointing the first element in the bucket with index n.size_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A constant local iterator pointing the 'one past the end' element in the bucket with index n.floatThe average number of elements per bucket.floatReturns the current maximum load factor.floatvoidChanges the container's maximum load factor, using z as a hint.size_typevoidChanges the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.unordered_map<Key, Mapped, Hash, Pred, Alloc> const&unordered_map<Key, Mapped, Hash, Pred, Alloc> const&boolThis is a boost extension.Behavior is undefined if the two containers don't have
equivalent equality predicates.unordered_map<Key, Mapped, Hash, Pred, Alloc> const&unordered_map<Key, Mapped, Hash, Pred, Alloc> const&boolThis is a boost extension.Behavior is undefined if the two containers don't have
equivalent equality predicates.unordered_map<Key, Mapped, Hash, Pred, Alloc>&unordered_map<Key, Mapped, Hash, Pred, Alloc>&voidx.swap(y)If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred.For a discussion of the behavior when allocators aren't equal see
the implementation details.boost::hash<Key>std::equal_to<Key>std::allocator<std::pair<Key const, Mapped> >
An unordered associative container that associates keys with another value. The same key can be stored multiple times.
Based on chapter 23 of
the working draft of the C++ standard [n2960].
But without the updated rules for allocators.
Template ParametersKeyKey must be Assignable and CopyConstructible.MappedMapped must be CopyConstructibleHashA unary function object type that acts a hash function for a Key. It takes a single argument of type Key and returns a value of type std::size_t.PredA binary function object that implements an equivalence relation on values of type Key.
A binary function object that induces an equivalence relation on values of type Key.
It takes two arguments of type Key and returns a value of type bool.AllocAn 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.Keystd::pair<Key const, Mapped>MappedHashPredAlloctypename allocator_type::pointertypename allocator_type::const_pointertypename allocator_type::referencelvalue of value_type.typename allocator_type::const_referenceconst lvalue of value_type.implementation-definedAn unsigned integral type.size_type can represent any non-negative value of difference_type.implementation-definedA signed integral type.Is identical to the difference type of iterator and const_iterator.implementation-definedA iterator whose value type is value_type. The iterator category is at least a forward iterator.Convertible to const_iterator.implementation-definedA constant iterator whose value type is value_type. The iterator category is at least a forward iterator.implementation-definedAn 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.implementation-definedA 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.size_typeimplementation-definedhasher const&hasher()key_equal const&key_equal()allocator_type const&allocator_type()size() == 0Constructs 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.InputIteratorInputIteratorsize_typeimplementation-definedhasher const&hasher()key_equal const&key_equal()allocator_type const&allocator_type()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.unordered_multimap const&The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.value_type is copy constructibleunordered_multimap &&The move constructor.This is emulated on compilers without rvalue references.value_type is move constructible.
(TODO: This is not actually required in this implementation).
Allocator const&Constructs an empty container, using allocator a.unordered_multimap const&Allocator const&Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.The destructor is applied to every element, and all memory is deallocatedunordered_multimap const&unordered_multimap&The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.
On compilers without rvalue references, there is a single assignment
operator with the signature operator=(unordered_multimap)
in order to emulate move semantics.
value_type is copy constructibleunordered_multimap &&unordered_multimap&The move assignment operator.
On compilers without rvalue references, there is a single assignment
operator with the signature operator=(unordered_multimap)
in order to emulate move semantics.
value_type is move constructible.
(TODO: This is not actually required in this implementation).
allocator_typeboolsize() == 0size_typestd::distance(begin(), end())size_typesize() of the largest possible container.
iteratorconst_iteratorAn iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
iteratorconst_iteratorAn iterator which refers to the past-the-end value for the container.
const_iteratorA 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_iteratorA constant iterator which refers to the past-the-end value for the container.
Args&&iteratorInserts an object, constructed with the arguments args, in the container.An iterator pointing to the inserted element.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratorArgs&&iteratorInserts an object, constructed with the arguments args, in the container.hint is a suggestion to where the element should be inserted.An iterator pointing to the inserted element.If an exception is thrown by an operation other than a call to hasher the function has no effect.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 key. 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.value_type const&iteratorInserts obj in the container.An iterator pointing to the inserted element.If an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratorvalue_type const&iteratorInserts obj in the container.hint is a suggestion to where the element should be inserted.An iterator pointing to the inserted element.If an exception is thrown by an operation other than a call to hasher the function has no effect.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 key. 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.InputIteratorInputIteratorvoidInserts a range of elements into the container.When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.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.const_iteratoriteratorErase the element pointed to by position.The iterator following position before the erasure.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.
When the number of elements is a lot smaller than the number of buckets
this function can be very inefficient as it has to search through empty
buckets for the next element, in order to return the iterator.
The method quick_erase is faster, but has yet
to be standardized.
key_type const&size_typeErase all elements with key equivalent to k.The number of elements erased.Only throws an exception if it is thrown by hasher or key_equal.const_iteratorconst_iteratoriteratorErases the elements in the range from first to last.The iterator following the erased elements - i.e. last.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.const_iteratorvoidErase the element pointed to by position.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.
This method is faster than erase as
it doesn't have to find the next element in the container -
a potentially costly operation.
As it hasn't been standardized, it's likely that this may
change in the future.
const_iteratorvoidErase the element pointed to by position.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.
This method is now deprecated, use
quick_return instead. Although be
warned that as that isn't standardized yet, it could also
change.
voidErases all elements in the container.size() == 0Never throws an exception.unordered_multimap&voidIf the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.For a discussion of the behavior when allocators aren't equal see
the implementation details.hasherThe container's hash function.
key_equalThe container's key equality predicate.
key_type const&iteratorkey_type const&const_iteratorCompatibleKey const&CompatibleHash const&CompatiblePredicate const&iteratorCompatibleKey const&CompatibleHash const&CompatiblePredicate const&const_iteratorAn iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.
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.
key_type const&size_typeThe number of elements with key equivalent to k.key_type const&std::pair<iterator, iterator>key_type const&std::pair<const_iterator, const_iterator>A range containing all elements with key equivalent to k.
If the container doesn't container any such elements, returns
std::make_pair(b.end(),b.end()).
size_typeThe number of buckets.size_typeAn upper bound on the number of buckets.size_typesize_typen < bucket_count()The number of elements in bucket n.key_type const&size_typeThe index of the bucket which would contain an element with key k.The return value is less than bucket_count()size_typelocal_iteratorsize_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A local iterator pointing the first element in the bucket with index n.size_typelocal_iteratorsize_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A local iterator pointing the 'one past the end' element in the bucket with index n.size_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A constant local iterator pointing the first element in the bucket with index n.size_typeconst_local_iteratorn shall be in the range [0, bucket_count()).A constant local iterator pointing the 'one past the end' element in the bucket with index n.floatThe average number of elements per bucket.floatReturns the current maximum load factor.floatvoidChanges the container's maximum load factor, using z as a hint.size_typevoidChanges the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&boolThis is a boost extension.Behavior is undefined if the two containers don't have
equivalent equality predicates.unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&boolThis is a boost extension.Behavior is undefined if the two containers don't have
equivalent equality predicates.unordered_multimap<Key, Mapped, Hash, Pred, Alloc>&unordered_multimap<Key, Mapped, Hash, Pred, Alloc>&voidx.swap(y)If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred.For a discussion of the behavior when allocators aren't equal see
the implementation details.