The vector::max_size() is a built-in function in C++ STL which returns the maximum number of elements that can be held by the vector container.
Parameters: The function does not accept any parameters.
Return value: The function returns the maximum numbers that can fit into the vector container.
Program below illustrates the above function:
max_size of vector 1 = 4611686018427387903 max_size of vector 2 = 4611686018427387903
- multimap maxsize() in C++ STL
- vector emplace() function in C++ STL
- Passing vector to a function in C++
- vector data() function in C++ STL
- vector shrink_to_fit() function in C++ STL
- vector insert() function in C++ STL
- vector capacity() function in C++ STL
- vector rbegin() and rend() function in C++ STL
- vector :: cbegin() and vector :: cend() in C++ STL
- vector::crend() & vector::crbegin() with example
- vector::front() and vector::back() in C++ STL
- vector::push_back() and vector::pop_back() in C++ STL
- vector::empty() and vector::size() in C++ STL
- vector::at() and vector::swap() in C++ STL
- vector::begin() and vector::end() in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.