Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

vector::max_size 

Returns the maximum length of the vector.


size_type max_size( ) const;

The maximum possible length of the vector.

// vector_max_size.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;   
   vector <int> v1;
   vector <int>::size_type i;

   i = v1.max_size( );   
   cout << "The maximum possible length of the vector is " << i << "." << endl;
}

The maximum possible length of the vector is 1073741823.

Header: <vector>

Community Additions

Show:
© 2017 Microsoft