Construction, destruction, copying¶
Empty container constructors¶
concurrent_hash_map(); explicit concurrent_hash_map( const HashCompare& compare, const allocator_type& alloc = allocator_type() ); explicit concurrent_hash_map( const allocator_type& alloc );Constructs an empty
concurrent_hash_map. The initial number of buckets is unspecified.If provided, uses the comparator
compareto calculate hash codes and comparekey_typeobjects for equality and the allocatorallocto allocate the memory.
concurrent_hash_map( size_type n, const HashCompare& compare, const allocator_type& alloc = allocator_type() ); concurrent_hash_map( size_type n, const allocator_type& alloc = allocator_type() );Constructs an empty
concurrent_hash_mapwithnpreallocated buckets.If provided, uses the comparator
compareto calculate hash codes and comparekey_typeobjects for equality and the allocatorallocto allocate the memory.
Constructors from the sequence of elements¶
template <typename InputIterator> concurrent_hash_map( InputIterator first, InputIterator last, const HashCompare& compare, const allocator_type& alloc = allocator_type() ); template <typename InputIterator> concurrent_hash_map( InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type() );Constructs the
concurrent_hash_mapwhich 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 comparator
compareto calculate hash codes and comparekey_typeobjects for equality and the allocatorallocto allocate the memory.Requirements: the type
InputIteratorshall meet the requirements ofInputIteratorfrom [input.iterators] ISO C++ Standard section.
concurrent_hash_map( std::initializer_list<value_type> init, const HashCompare& compare, const allocator_type& alloc = allocator_type() );Equivalent to
concurrent_hash_map(init.begin(), init.end(), compare, alloc).
concurrent_hash_map( std::initializer_list<value_type> init, const allocator_type& alloc = allocator_type() );Equivalent to
concurrent_hash_map(init.begin(), init.end(), alloc).
Copying constructors¶
concurrent_hash_map( const concurrent_hash_map& other ); concurrent_hash_map( const concurrent_hash_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_hash_map( concurrent_hash_map&& other ); concurrent_hash_map( concurrent_hash_map&& other, const allocator_type& alloc );Constructs a
concurrent_hash_mapwith the content ofotherusing move semantics.
otheris 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_hash_map();Destroys the
concurrent_hash_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_hash_map& operator=( const concurrent_hash_map& other );Replaces all elements in
*thisby the copies of the elements inother.Copy assigns allocators if
std::allocator_traits<allocator_type>::propagate_on_container_copy_assignment::valueistrue.The behavior is undefined in case of concurrent operations with
*thisandother.Returns: a reference to
*this.
concurrent_hash_map& operator=( concurrent_hash_map&& other );Replaces all elements in
*thisby the elements inotherusing move semantics.
otheris left in a valid, but unspecified state.Move assigns allocators if
std::allocator_traits<allocator_type>::propagate_on_container_move_assignment::valueistrue.The behavior is undefined in case of concurrent operations with
*thisandother.Returns: a reference to
*this.
concurrent_hash_map& operator=( std::initializer_list<value_type> init );Replaces all elements in
*thisby the elements ininit.If
initcontains 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.
get_allocator¶
allocator_type get_allocator() const;Returns: a copy of the allocator associated with
*this.