An unordered associative container that stores unique values. Template Parameters Value Value must be Assignable and CopyConstructible Hash 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. The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. Value Value Hash Pred Alloc typename allocator_type::pointer value_type* if allocator_type::pointer is not defined. typename allocator_type::const_pointer boost::pointer_to_other<pointer, value_type>::type if allocator_type::const_pointer is not defined. value_type& lvalue of value_type. value_type const& const lvalue of value_type. implementation-defined An unsigned integral type. size_type can represent any non-negative value of difference_type. implementation-defined A signed integral type. Is identical to the difference type of iterator and const_iterator. implementation-defined A constant iterator whose value type is value_type. The iterator category is at least a forward iterator. Convertible to const_iterator. implementation-defined A constant iterator whose value type is value_type. The iterator category is at least a forward iterator. implementation-defined 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. implementation-defined 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. size_type implementation-defined hasher const& hasher() key_equal const& key_equal() allocator_type const& allocator_type() size() == 0 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. InputIterator InputIterator size_type implementation-defined hasher 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. If Allocator::select_on_container_copy_construction exists and has the right signature, the allocator will be constructed from its result. value_type is copy constructible unordered_set && The move constructor. This is implemented using Boost.Move. 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. 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 deallocated unordered_set const& unordered_set& 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. value_type is copy constructible unordered_set && unordered_set& 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. 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. value_type is move constructible. allocator_type bool size() == 0 size_type std::distance(begin(), end()) size_type size() of the largest possible container. iterator const_iterator An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. iterator const_iterator An iterator which refers to the past-the-end value for the container. const_iterator 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_iterator A 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. 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. const_iterator Args&& iterator 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. 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. 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. 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_iterator value_type const& iterator Inserts 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. InputIterator InputIterator void 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. 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_iterator iterator Erase 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 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. key_type const& size_type Erase 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_iterator const_iterator iterator Erases 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_iterator void Erase 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 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. const_iterator void Erase 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 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. void Erases all elements in the container. size() == 0 Never throws an exception. unordered_set& void Swaps the contents of the container with the parameter. 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. Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. 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. hasher The container's hash function. key_equal The container's key equality predicate. key_type const& iterator key_type const& const_iterator CompatibleKey const& CompatibleHash const& CompatiblePredicate const& iterator CompatibleKey const& CompatibleHash const& CompatiblePredicate const& const_iterator An 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_type The 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_type The number of buckets. size_type An upper bound on the number of buckets. size_type size_type n < bucket_count() The number of elements in bucket n. key_type const& size_type The index of the bucket which would contain an element with key k. The return value is less than bucket_count() size_type local_iterator size_type const_local_iterator n shall be in the range [0, bucket_count()). A local iterator pointing the first element in the bucket with index n. size_type local_iterator size_type const_local_iterator n 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_type const_local_iterator n shall be in the range [0, bucket_count()). A constant local iterator pointing the first element in the bucket with index n. size_type const_local_iterator n 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. float The average number of elements per bucket. float Returns the current maximum load factor. float void Changes the container's maximum load factor, using z as a hint. size_type void Changes 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& bool Return true if x.size() == y.size and for every element in x, there is an element in y with the same for the same key, with an equal value (using operator== to compare the value types). The behavior of this function was changed to match the C++11 standard in Boost 1.48. If you wish to use the old behaviour, define the macro BOOST_UNORDERED_DEPRECATED_EQUALITY. 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& bool Return false if x.size() == y.size and for every element in x, there is an element in y with the same for the same key, with an equal value (using operator== to compare the value types). The behavior of this function was changed to match the C++11 standard in Boost 1.48. If you wish to use the old behaviour, define the macro BOOST_UNORDERED_DEPRECATED_EQUALITY. 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>& void x.swap(y) Swaps the contents of x and y. 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. Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. 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 unordered associative container that stores values. The same key can be stored multiple times. Template Parameters Value Value must be Assignable and CopyConstructible Hash 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. Value Value Hash Pred Alloc typename allocator_type::pointer value_type* if allocator_type::pointer is not defined. typename allocator_type::const_pointer boost::pointer_to_other<pointer, value_type>::type if allocator_type::const_pointer is not defined. value_type& lvalue of value_type. value_type const& const lvalue of value_type. implementation-defined An unsigned integral type. size_type can represent any non-negative value of difference_type. implementation-defined A signed integral type. Is identical to the difference type of iterator and const_iterator. implementation-defined A constant iterator whose value type is value_type. The iterator category is at least a forward iterator. Convertible to const_iterator. implementation-defined A constant iterator whose value type is value_type. The iterator category is at least a forward iterator. implementation-defined 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. implementation-defined 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. size_type implementation-defined hasher const& hasher() key_equal const& key_equal() allocator_type const& allocator_type() size() == 0 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. InputIterator InputIterator size_type implementation-defined hasher 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. If Allocator::select_on_container_copy_construction exists and has the right signature, the allocator will be constructed from its result. value_type is copy constructible unordered_multiset && The move constructor. This is implemented using Boost.Move. 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. 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 deallocated unordered_multiset const& unordered_multiset& 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. value_type is copy constructible unordered_multiset && 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. 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. value_type is move constructible. allocator_type bool size() == 0 size_type std::distance(begin(), end()) size_type size() of the largest possible container. iterator const_iterator An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. iterator const_iterator An iterator which refers to the past-the-end value for the container. const_iterator 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_iterator A constant iterator which refers to the past-the-end value for the container. Args&& iterator Inserts 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. 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. const_iterator Args&& iterator Inserts 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. 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. value_type const& iterator Inserts 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_iterator value_type const& iterator Inserts 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. InputIterator InputIterator void 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. 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_iterator iterator Erase 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 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. key_type const& size_type Erase 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_iterator const_iterator iterator Erases 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_iterator void Erase 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 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. const_iterator void Erase 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 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. void Erases all elements in the container. size() == 0 Never throws an exception. unordered_multiset& void Swaps the contents of the container with the parameter. 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. Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. 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. hasher The container's hash function. key_equal The container's key equality predicate. key_type const& iterator key_type const& const_iterator CompatibleKey const& CompatibleHash const& CompatiblePredicate const& iterator CompatibleKey const& CompatibleHash const& CompatiblePredicate const& const_iterator An 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_type The 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_type The number of buckets. size_type An upper bound on the number of buckets. size_type size_type n < bucket_count() The number of elements in bucket n. key_type const& size_type The index of the bucket which would contain an element with key k. The return value is less than bucket_count() size_type local_iterator size_type const_local_iterator n shall be in the range [0, bucket_count()). A local iterator pointing the first element in the bucket with index n. size_type local_iterator size_type const_local_iterator n 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_type const_local_iterator n shall be in the range [0, bucket_count()). A constant local iterator pointing the first element in the bucket with index n. size_type const_local_iterator n 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. float The average number of elements per bucket. float Returns the current maximum load factor. float void Changes the container's maximum load factor, using z as a hint. size_type void Changes 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& bool Return true if x.size() == y.size and for every equivalent key group in x, there is a group in y for the same key, which is a permutation (using operator== to compare the value types). The behavior of this function was changed to match the C++11 standard in Boost 1.48. If you wish to use the old behaviour, define the macro BOOST_UNORDERED_DEPRECATED_EQUALITY. 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& bool Return false if x.size() == y.size and for every equivalent key group in x, there is a group in y for the same key, which is a permutation (using operator== to compare the value types). The behavior of this function was changed to match the C++11 standard in Boost 1.48. If you wish to use the old behaviour, define the macro BOOST_UNORDERED_DEPRECATED_EQUALITY. 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>& void x.swap(y) Swaps the contents of x and y. 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. Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. 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 unordered associative container that associates unique keys with another value. Template Parameters Key Key must be Assignable and CopyConstructible. Mapped Mapped must be CopyConstructible Hash A 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. Pred A 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. 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. The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. Key std::pair<Key const, Mapped> Mapped Hash Pred Alloc typename allocator_type::pointer value_type* if allocator_type::pointer is not defined. typename allocator_type::const_pointer boost::pointer_to_other<pointer, value_type>::type if allocator_type::const_pointer is not defined. value_type& lvalue of value_type. value_type const& const lvalue of value_type. implementation-defined An unsigned integral type. size_type can represent any non-negative value of difference_type. implementation-defined A signed integral type. Is identical to the difference type of iterator and const_iterator. implementation-defined An iterator whose value type is value_type. The iterator category is at least a forward iterator. Convertible to const_iterator. implementation-defined A constant iterator whose value type is value_type. The iterator category is at least a forward iterator. implementation-defined 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. implementation-defined 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. size_type implementation-defined hasher const& hasher() key_equal const& key_equal() allocator_type const& allocator_type() size() == 0 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. InputIterator InputIterator size_type implementation-defined hasher 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. If Allocator::select_on_container_copy_construction exists and has the right signature, the allocator will be constructed from its result. value_type is copy constructible unordered_map && The move constructor. This is implemented using Boost.Move. 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. 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 deallocated unordered_map const& unordered_map& 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. value_type is copy constructible unordered_map && unordered_map& 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. 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. value_type is move constructible. allocator_type bool size() == 0 size_type std::distance(begin(), end()) size_type size() of the largest possible container. iterator const_iterator An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. iterator const_iterator An iterator which refers to the past-the-end value for the container. const_iterator 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_iterator A 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. 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. const_iterator Args&& iterator 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. 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. 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. 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_iterator value_type const& iterator Inserts 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. InputIterator InputIterator void 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 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_iterator iterator Erase 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 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. key_type const& size_type Erase 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_iterator const_iterator iterator Erases 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_iterator void Erase 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 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. const_iterator void Erase 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 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. void Erases all elements in the container. size() == 0 Never throws an exception. unordered_map& void Swaps the contents of the container with the parameter. 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. Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. 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. hasher The container's hash function. key_equal The container's key equality predicate. key_type const& iterator key_type const& const_iterator CompatibleKey const& CompatibleHash const& CompatiblePredicate const& iterator CompatibleKey const& CompatibleHash const& CompatiblePredicate const& const_iterator An 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_type The 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 k 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. 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. size_type The number of buckets. size_type An upper bound on the number of buckets. size_type size_type n < bucket_count() The number of elements in bucket n. key_type const& size_type The index of the bucket which would contain an element with key k. The return value is less than bucket_count() size_type local_iterator size_type const_local_iterator n shall be in the range [0, bucket_count()). A local iterator pointing the first element in the bucket with index n. size_type local_iterator size_type const_local_iterator n 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_type const_local_iterator n shall be in the range [0, bucket_count()). A constant local iterator pointing the first element in the bucket with index n. size_type const_local_iterator n 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. float The average number of elements per bucket. float Returns the current maximum load factor. float void Changes the container's maximum load factor, using z as a hint. size_type void Changes 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& bool Return true if x.size() == y.size and for every element in x, there is an element in y with the same for the same key, with an equal value (using operator== to compare the value types). The behavior of this function was changed to match the C++11 standard in Boost 1.48. If you wish to use the old behaviour, define the macro BOOST_UNORDERED_DEPRECATED_EQUALITY. 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& bool Return false if x.size() == y.size and for every element in x, there is an element in y with the same for the same key, with an equal value (using operator== to compare the value types). The behavior of this function was changed to match the C++11 standard in Boost 1.48. If you wish to use the old behaviour, define the macro BOOST_UNORDERED_DEPRECATED_EQUALITY. 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>& void x.swap(y) Swaps the contents of x and y. 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. Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. 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 unordered associative container that associates keys with another value. The same key can be stored multiple times. Template Parameters Key Key must be Assignable and CopyConstructible. Mapped Mapped must be CopyConstructible Hash A 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. Pred A 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. 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. Key std::pair<Key const, Mapped> Mapped Hash Pred Alloc typename allocator_type::pointer value_type* if allocator_type::pointer is not defined. typename allocator_type::const_pointer boost::pointer_to_other<pointer, value_type>::type if allocator_type::const_pointer is not defined. value_type& lvalue of value_type. value_type const& const lvalue of value_type. implementation-defined An unsigned integral type. size_type can represent any non-negative value of difference_type. implementation-defined A signed integral type. Is identical to the difference type of iterator and const_iterator. implementation-defined An iterator whose value type is value_type. The iterator category is at least a forward iterator. Convertible to const_iterator. implementation-defined A constant iterator whose value type is value_type. The iterator category is at least a forward iterator. implementation-defined 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. implementation-defined 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. size_type implementation-defined hasher const& hasher() key_equal const& key_equal() allocator_type const& allocator_type() size() == 0 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. InputIterator InputIterator size_type implementation-defined hasher 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. If Allocator::select_on_container_copy_construction exists and has the right signature, the allocator will be constructed from its result. value_type is copy constructible unordered_multimap && The move constructor. This is implemented using Boost.Move. 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. 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 deallocated unordered_multimap const& unordered_multimap& 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. value_type is copy constructible unordered_multimap && unordered_multimap& 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. 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. value_type is move constructible. allocator_type bool size() == 0 size_type std::distance(begin(), end()) size_type size() of the largest possible container. iterator const_iterator An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. iterator const_iterator An iterator which refers to the past-the-end value for the container. const_iterator 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_iterator A constant iterator which refers to the past-the-end value for the container. Args&& iterator Inserts 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. 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. const_iterator Args&& iterator Inserts 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. 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. value_type const& iterator Inserts 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_iterator value_type const& iterator Inserts 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. InputIterator InputIterator void 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 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_iterator iterator Erase 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 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. key_type const& size_type Erase 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_iterator const_iterator iterator Erases 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_iterator void Erase 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 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. const_iterator void Erase 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 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. void Erases all elements in the container. size() == 0 Never throws an exception. unordered_multimap& void Swaps the contents of the container with the parameter. 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. Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. 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. hasher The container's hash function. key_equal The container's key equality predicate. key_type const& iterator key_type const& const_iterator CompatibleKey const& CompatibleHash const& CompatiblePredicate const& iterator CompatibleKey const& CompatibleHash const& CompatiblePredicate const& const_iterator An 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_type The 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_type The number of buckets. size_type An upper bound on the number of buckets. size_type size_type n < bucket_count() The number of elements in bucket n. key_type const& size_type The index of the bucket which would contain an element with key k. The return value is less than bucket_count() size_type local_iterator size_type const_local_iterator n shall be in the range [0, bucket_count()). A local iterator pointing the first element in the bucket with index n. size_type local_iterator size_type const_local_iterator n 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_type const_local_iterator n shall be in the range [0, bucket_count()). A constant local iterator pointing the first element in the bucket with index n. size_type const_local_iterator n 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. float The average number of elements per bucket. float Returns the current maximum load factor. float void Changes the container's maximum load factor, using z as a hint. size_type void Changes 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& bool Return true if x.size() == y.size and for every equivalent key group in x, there is a group in y for the same key, which is a permutation (using operator== to compare the value types). The behavior of this function was changed to match the C++11 standard in Boost 1.48. If you wish to use the old behaviour, define the macro BOOST_UNORDERED_DEPRECATED_EQUALITY. 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& bool Return false if x.size() == y.size and for every equivalent key group in x, there is a group in y for the same key, which is a permutation (using operator== to compare the value types). The behavior of this function was changed to match the C++11 standard in Boost 1.48. If you wish to use the old behaviour, define the macro BOOST_UNORDERED_DEPRECATED_EQUALITY. 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>& void x.swap(y) Swaps the contents of x and y. 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. Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. 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.