VOOZH about

URL: https://www.geeksforgeeks.org/cpp/unordered_map-max_size-in-c-stl/

⇱ unordered_map max_size in C++ STL - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

unordered_map max_size in C++ STL

Last Updated : 18 Sep, 2024

The

unordered_map::max_size

is a built in function in C++ STL. It returns maximum number of elements which unordered_map can hold. Maximum number of elements in any container depends upon system and library implementation.

Syntax

size unordered_map.max_size()

Parameters:

It does not accept any parameters.

Return type:

Unsigned integer a container can hold maximum elements.

Example 1


Output
Current size is : 0
 max size is : 1152921504606846975
 Current size is : 4
 max size is : 1152921504606846975

Example 2


Output
Current size is : 0
 max size is : 1152921504606846975
 Current size is : 3
 max size is : 1152921504606846975

Complexity :

Its complexity is constant.

Comment