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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- multimap maxsize() in C++ STL
- vector shrink_to_fit() function in C++ STL
- vector data() function in C++ STL
- Passing vector to a function in C++
- vector insert() function in C++ STL
- vector capacity() function in C++ STL
- vector emplace() function in C++ STL
- vector rbegin() and rend() function in C++ STL
- vector::empty() and vector::size() in C++ STL
- vector::front() and vector::back() in C++ STL
- vector::crend() & vector::crbegin() with example
- vector :: cbegin() and vector :: cend() in C++ STL
- How to flatten a Vector of Vectors or 2D Vector in C++
- vector::push_back() and vector::pop_back() in C++ STL
- vector::begin() and vector::end() in C++ STL
- vector::at() and vector::swap() in C++ STL
- Vector in C++ STL
- How does a vector work in C++?
- vector::operator= and vector::operator[ ] in C++ STL
- vector : : resize() 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.