共用方式為


map::max_size

傳回對應的最大長度。

size_type max_size( ) const;

傳回值

對應的最大可能長度。

範例

// map_max_size.cpp
// compile with: /EHsc
#include <map>
#include <iostream>

int main( )
{
   using namespace std;
   map <int, int> m1;
   map <int, int> :: size_type i;

   i = m1.max_size( );
   cout << "The maximum possible length "
        << "of the map is " << i << "."
        << endl << "(Magnitude is machine specific.)";
}

範例輸出

以下輸出(x86)。

The maximum possible length of the map is 536870911.
(Magnitude is machine specific.)

需求

標頭:<map>

命名空間: std

請參閱

參考

map 類別

map::max_size、map::clear、map::erase 和 map::size

標準樣板程式庫