Construction, destruction, copying#
Empty container constructors#
concurrent_hash_map(); explicit concurrent_hash_map( const hash_compare_type& 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
compare
to calculate hash codes and comparekey_type
objects for equality and the allocatoralloc
to allocate the memory.
concurrent_hash_map( size_type n, const hash_compare_type& compare, const allocator_type& alloc = allocator_type() ); concurrent_hash_map( size_type n, const allocator_type& alloc = allocator_type() );Constructs an empty
concurrent_hash_map
withn
preallocated buckets.If provided, uses the comparator
compare
to calculate hash codes and comparekey_type
objects for equality and the allocatoralloc
to allocate the memory.
Constructors from the sequence of elements#
template <typename InputIterator> concurrent_hash_map( InputIterator first, InputIterator last, const hash_compare_type& 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_map
which 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
compare
to calculate hash codes and 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_hash_map( std::initializer_list<value_type> init, const hash_compare_type& compare = hash_compare_type(), 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 );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_map
with the content 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_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
*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_hash_map& operator=( concurrent_hash_map&& other );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
.
concurrent_hash_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 is 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
.