Construction, destruction, copying#
Empty container constructors#
concurrent_unordered_map(); explicit concurrent_unordered_map( const allocator_type& alloc );Constructs an empty
concurrent_unordered_map
. The initial number of buckets is unspecified.If provided, uses the allocator
alloc
to allocate the memory.
explicit concurrent_unordered_map( size_type bucket_count, const hasher& hash = hasher(), const key_equal& equal = key_equal(), const allocator_type& alloc = allocator_type() ); concurrent_unordered_map( size_type bucket_count, const allocator_type& alloc ); concurrent_unordered_map( size_type bucket_count, const hasher& hash, const allocator_type& alloc );Constructs an empty
concurrent_unordered_map
withbucket_count
buckets.If provided, uses the hash function
hasher
, predicateequal
to comparekey_type
objects for equality, and the allocatoralloc
to allocate the memory.
Constructors from the sequence of elements#
template <typename InputIterator> concurrent_unordered_map( InputIterator first, InputIterator last, size_type bucket_count = /*implementation-defined*/, const hasher& hash = hasher(), const key_equal& equal = key_equal(), const allocator_type& alloc = allocator_type() ); template <typename Inputiterator> concurrent_unordered_map( InputIterator first, InputIterator last, size_type bucket_count, const allocator_type& alloc ); template <typename InputIterator> concurrent_unordered_map( InputIterator first, InputIterator last, size_type bucket_count, const hasher& hash, const allocator_type& alloc );Constructs the
concurrent_unordered_map
that contains the elements from the half-open interval[first, last)
.If the range
[first, last)
contains multiple elements with equal keys, it is unspecified which element would be inserted.If provided, uses the hash function
hasher
, predicateequal
to comparekey_type
objects for equality, and the allocatoralloc
to allocate the memory.Requirements: the type
InputIterator
must meet the requirements ofInputIterator
from the [input.iterators] ISO C++ Standard section.
concurrent_unordered_map( std::initializer_list<value_type> init, size_type bucket_count = /*implementation-defined*/, const hasher& hash = hasher(), const key_equal& equal = key_equal(), const allocator_type& alloc = allocator_type() );Equivalent to
concurrent_unordered_map(init.begin(), init.end(), bucket_count, hash, equal, alloc)
.
concurrent_unordered_map( std::initializer_list<value_type> init, size_type bucket_count, const allocator_type& alloc );Equivalent to
concurrent_unordered_map(init.begin(), init.end(), bucket_count, alloc)
.
concurrent_unordered_map( std::initializer_list<value_type> init, size_type bucket_count, const hasher& hash, const allocator_type& alloc );Equivalent to
concurrent_unordered_map(init.begin(), init.end(), bucket_count, hash, alloc)
.
Copying constructors#
concurrent_unordered_map( const concurrent_unordered_map& other ); concurrent_unordered_map( const concurrent_unordered_map& other, const allocator_type& alloc );Constructs a copy of
other
.If the allocator argument is not provided, it is obtained by calling
std::allocator_traits<allocator_type>::select_on_container_copy_construction(other.get_allocator())
.The behavior is undefined in case of concurrent operations with
other
.
Moving constructors#
concurrent_unordered_map( concurrent_unordered_map&& other ); concurrent_unordered_map( concurrent_unordered_map&& other, const allocator_type& alloc );Constructs a
concurrent_unordered_map
with the contents ofother
using move semantics.
other
is left in a valid, but unspecified state.If the allocator argument is not provided, it is obtained by calling
std::move(other.get_allocator())
.The behavior is undefined in case of concurrent operations with
other
.
Destructor#
~concurrent_unordered_map();Destroys the
concurrent_unordered_map
. Calls destructors of the stored elements and deallocates the used storage.The behavior is undefined in case of concurrent operations with
*this
.
Assignment operators#
concurrent_unordered_map& operator=( const concurrent_unordered_map& other );Replaces all elements in
*this
by the copies of the elements inother
.Copy-assigns allocators if
std::allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value
istrue
.The behavior is undefined in case of concurrent operations with
*this
andother
.Returns: a reference to
*this
.
concurrent_unordered_map& operator=( concurrent_unordered_map&& other ) noexcept(/*See below*/);Replaces all elements in
*this
by the elements inother
using move semantics.
other
is left in a valid, but unspecified state.Move-assigns allocators if
std::allocator_traits<allocator_type>::propagate_on_container_move_assignment::value
istrue
.The behavior is undefined in case of concurrent operations with
*this
andother
.Returns: a reference to
*this
.Exceptions:
noexcept
specification:noexcept(std::allocator_traits<allocator_type>::is_always_equal::value && std::is_nothrow_move_assignable<hasher>::value && std::is_nothrow_move_assignable<key_equal>::value)
concurrent_unordered_map& operator=( std::initializer_list<value_type> init );Replaces all elements in
*this
by the elements ininit
.If
init
contains multiple elements with equal keys, it is unspecified which element would be inserted.The behavior is undefined in case of concurrent operations with
*this
.Returns: a reference to
*this
.