共用方式為


vector::max_size

Returns the maximum length of the vector.

size_type max_size( ) const;

Return Value

The maximum possible length of the vector.

Example

// 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;
}

Sample Output

The maximum possible length of the vector is 1073741823.

Requirements

Header: <vector>

Namespace: std

See Also

Reference

vector Class

Standard Template Library

Other Resources

vector Members