Namespaces
Variants
Actions

std::unordered_map<Key,T,Hash,KeyEqual,Allocator>::unordered_map

From cppreference.com
 
 
 
 
(1)
unordered_map()
    : unordered_map(size_type(/* unspecified */)) {}
(since C++11)
(until C++20)
unordered_map();
(since C++20)
explicit unordered_map( size_type bucket_count,

                        const Hash& hash = Hash(),
                        const key_equal& equal = key_equal(),

                        const Allocator& alloc = Allocator() );
(2) (since C++11)
unordered_map( size_type bucket_count,

               const Allocator& alloc )

    : unordered_map(bucket_count, Hash(), key_equal(), alloc) {}
(3) (since C++14)
unordered_map( size_type bucket_count,

               const Hash& hash,
               const Allocator& alloc )

    : unordered_map(bucket_count, hash, key_equal(), alloc) {}
(4) (since C++14)
explicit unordered_map( const Allocator& alloc );
(5) (since C++11)
template< class InputIt >

unordered_map( InputIt first, InputIt last,
               size_type bucket_count = /* unspecified */,
               const Hash& hash = Hash(),
               const key_equal& equal = key_equal(),

               const Allocator& alloc = Allocator() );
(6) (since C++11)
template< class InputIt >

unordered_map( InputIt first, InputIt last,
               size_type bucket_count,
               const Allocator& alloc )
    : unordered_map(first, last,

                    bucket_count, Hash(), key_equal(), alloc) {}
(7) (since C++14)
template< class InputIt >

unordered_map( InputIt first, InputIt last,
               size_type bucket_count,
               const Hash& hash,
               const Allocator& alloc )
    : unordered_map(first, last,

                    bucket_count, hash, key_equal(), alloc) {}
(8) (since C++14)
unordered_map( const unordered_map& other );
(9) (since C++11)
unordered_map( const unordered_map& other, const Allocator& alloc );
(10) (since C++11)
unordered_map( unordered_map&& other );
(11) (since C++11)
unordered_map( unordered_map&& other, const Allocator& alloc );
(12) (since C++11)
unordered_map( std::initializer_list<value_type> init,

               size_type bucket_count = /* unspecified */,
               const Hash& hash = Hash(),
               const key_equal& equal = key_equal(),

               const Allocator& alloc = Allocator() );
(13) (since C++11)
unordered_map( std::initializer_list<value_type> init,

               size_type bucket_count,
               const Allocator& alloc )
    : unordered_map(init, bucket_count,

                    Hash(), key_equal(), alloc) {}
(14) (since C++14)
unordered_map( std::initializer_list<value_type> init,

               size_type bucket_count,
               const Hash& hash,
               const Allocator& alloc )
    : unordered_map(init, bucket_count,

                    hash, key_equal(), alloc) {}
(15) (since C++14)
template< container-compatible-range<value_type> R >

unordered_map( std::from_range_t, R&& rg,
               size_type bucket_count = /* see description */,
               const Hash& hash = Hash(),
               const key_equal& equal = key_equal(),

               const Allocator& alloc = Allocator() );
(16) (since C++23)
template< container-compatible-range<value_type> R >

unordered_map( std::from_range_t, R&& rg,
               size_type bucket_count,
               const Allocator& alloc )
    : unordered_map(std::from_range, std::forward<R>(rg),

                    bucket_count, Hash(), key_equal(), alloc) {}
(17) (since C++23)
template< container-compatible-range<value_type> R >

unordered_map( std::from_range_t, R&& rg,
               size_type bucket_count,
               const Hash& hash,
               const Alloc& alloc )
    : unordered_map(std::from_range, std::forward<R>(rg),

                    bucket_count, hash, key_equal(), alloc) {}
(18) (since C++23)

Constructs new container from a variety of data sources. Optionally uses user supplied bucket_count as a minimal number of buckets to create, hash as the hash function, equal as the function to compare keys and alloc as the allocator.

1-5) Constructs empty container. Sets max_load_factor() to 1.0. For the default constructor, the number of buckets is unspecified.
6-8) Constructs the container with the contents of the range [firstlast). Sets max_load_factor() to 1.0. If multiple elements in the range have keys that compare equivalent, it is unspecified which element is inserted (pending