std::unordered_map::max_load_factor

float max_load_factor() const; (1) (since C++11) void max_load_factor( float ml ); (2) (since C++11) Manages the maximum load factor (number of elements per bucket). The container automatically increases the number of buckets if the load factor exceeds this threshold. 1) Returns current maximum load factor. 2) Sets the maximum load factor to ml. Parameters ml - new maximum load factor setting Return value 1) current maximum load factor. 2) none. Complexity Constan

std::unordered_map::insert_or_assign

template <class M> pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); (1) (since C++17) template <class M> pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); (2) (since C++17) template <class M> iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); (3) (since C++17) template <class M> iterator insert_or_assign(const_iterator hint, key_type&& k,

std::unordered_map::get_allocator

allocator_type get_allocator() const; (since C++11) Returns the allocator associated with the container. Parameters (none). Return value The associated allocator. Complexity Constant.

std::unordered_map::erase

iterator erase( const_iterator pos ); (1) (since C++11) iterator erase( const_iterator first, const_iterator last ); (2) (since C++11) size_type erase( const key_type& key ); (3) (since C++11) Removes specified elements from the container. 1) Removes the element at pos. 2) Removes the elements in the range [first; last), which must be a valid range in *this. 3) Removes the element (if one exists) with the key equivalent to key. References and iterators to the erased e

std::unordered_map::insert

std::pair<iterator,bool> insert( const value_type& value ); (1) (since C++11) template< class P > std::pair<iterator,bool> insert( P&& value ); (2) (since C++11) std::pair<iterator,bool> insert( value_type&& value ); (2) (since C++17) iterator insert( const_iterator hint, const value_type& value ); (3) (since C++11) template< class P > iterator insert( const_iterator hint, P&& value ); (4) (since C++11)

std::unordered_map::find

iterator find( const Key& key ); (1) const_iterator find( const Key& key ) const; (2) 1,2) Finds an element with key equivalent to key. Parameters key - key value of the element to search for Return value Iterator to an element with key equivalent to key. If no such element is found, past-the-end (see end()) iterator is returned. Complexity Constant on average, worst case linear in the size of the container. Example #include <iostream> #includ

std::unordered_map::hash_function

hasher hash_function() const; (since C++11) Returns the function that hashes the keys. Parameters (none). Return value The hash function. Complexity Constant. See also key_eq returns the function used to compare keys for equality (public member function)

std::unordered_map::emplace_hint

template <class... Args> iterator emplace_hint( const_iterator hint, Args&&... args ); (since C++11) Inserts a new element to the container, using hint as a suggestion where the element should go. The element is constructed in-place, i.e. no copy or move operations are performed. The constructor of the element type (value_type, that is, std::pair<const Key, T>) is called with exactly the same arguments as supplied to the function, forwarded with std::forward<Args&

std::unordered_map::emplace

template< class... Args > std::pair<iterator,bool> emplace( Args&&... args ); (since C++11) Inserts a new element into the container by constructing it in-place with the given args if there is no element with the key in the container. Careful use of emplace allows the new element to be constructed while avoiding unnecessary copy or move operations. The constructor of the new element (i.e. std::pair<const Key, T>) is called with exactly the same arguments as sup

std::unordered_map::end(int)

local_iterator end( size_type n ); (since C++11) const_local_iterator end( size_type n ) const; (since C++11) const_local_iterator cend( size_type n ) const; (since C++11) Returns an iterator to the element following the last element of the bucket with index n. . This element acts as a placeholder, attempting to access it results in undefined behavior. Parameters n - the index of the bucket to access Return value iterator to the element following the last eleme