std::unordered_map::empty

bool empty() const; (since C++11) Checks if the container has no elements, i.e. whether begin() == end(). Parameters (none). Return value true if the container is empty, false otherwise. Exceptions noexcept specification: noexcept Complexity Constant. Example The following code uses empty to check if a std::unordered_map<int,int> contains any elements: #include <unordered_map> #include <iostream> #include <utility> int main() { std::unorde

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::count

size_type count( const Key& key ) const; (1) (since C++11) Returns the number of elements with key key. Parameters key - key value of the elements to count Return value Number of elements with key key. Complexity Constant on average, worst case linear in the size of the container. See also find finds element with specific key (public member function) equal_range returns range of elements matching a specific key (public member function)

std::unordered_map::clear

void clear(); (since C++11) Removes all elements from the container. Invalidates any references, pointers, or iterators referring to contained elements. May invalidate any past-the-end iterators. Parameters (none). Return value (none). Exceptions noexcept specification: noexcept Complexity Linear in the size of the container. See also erase erases elements (public member function)

std::unordered_map::bucket_size

size_type bucket_size( size_type n ) const; (since C++11) Returns the number of elements in the bucket with index n. Parameters n - the index of the bucket to examine Return value The number of elements in the bucket n. Complexity Constant. See also bucket_count returns the number of buckets (public member function)

std::unordered_map::bucket_count

size_type bucket_count() const; (since C++11) Returns the number of buckets in the container. Parameters (none). Return value The number of buckets in the container. Complexity Constant. See also bucket_size returns the number of elements in specific bucket (public member function) max_bucket_count returns the maximum number of buckets (public member function)

std::unordered_map::bucket

size_type bucket( const Key& key ) const; (since C++11) Returns the index of the bucket for key key. Elements (if any) with keys equivalent to key are always found in this bucket. The returned value is valid only for instances of the container for which bucket_count() returns the same value. The behavior is undefined if bucket_count() is zero. Parameters key - the value of the key to examine Return value Bucket index for the key key. Complexity Constant. See also

std::unordered_map::begin(int)

local_iterator begin( size_type n ); (since C++11) const_local_iterator begin( size_type n ) const; (since C++11) const_local_iterator cbegin( size_type n ) const; (since C++11) Returns an iterator to the first element of the bucket with index pos. Parameters n - the index of the bucket to access Return value Iterator to the first element. Complexity Constant. See also end(int) cend(int) returns an iterator to the end of the specified bucket (public m

std::unordered_map::begin

iterator begin(); (since C++11) const_iterator begin() const; (since C++11) const_iterator cbegin() const; (since C++11) Returns an iterator to the first element of the container. If the container is empty, the returned iterator will be equal to end(). Parameters (none). Return value Iterator to the first element. Exceptions noexcept specification: noexcept Complexity Constant. Example See also end cend returns an iterator to the end (public member