共用方式為


vector::max_size

傳回所指定向量的最大長度。

size_type max_size( ) const;

傳回值

向量的可能的最大長度。

範例

// 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.

需求

標題: <vector>

命名空間: std

請參閱

參考

vector Class

標準樣板程式庫