C++ vector max_size() function
Example
Find out the size of a vector:
vector<string> cars = {"Volvo", "BMW", "Ford", "Mazda"};
cout << cars.max_size();
Try it Yourself »
Definition and Usage
The max_size()
function returns the maximum number of elements that a vector can store.
Syntax
vector.max_size();
Parameter Values
None.
Technical Details
Returns: | The maximum number of elements a vector can store. |
---|
Related Pages
Read more about vectors in our Vector Tutorial.