English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This function is used to return the maximum number of elements that the vector (vector) can accommodate.
Vector (vector) 'v' and maximum size 'm'. Syntax is:
int m = v.max_size();
It does not contain any parameters.
It returns the maximum number of elements that the vector (vector) can contain.
Let's see a simple example.
#include<iostream> #include<vector> using namespace std; int main() { vector<int> v{1,2,3,4,5}; std::cout << v.max_size() << std::endl; return 0; }
Output Result:
1073741823