Share via


map::max_size

Returns the maximum length of the map.

size_type max_size( ) const;

Return Value

The maximum possible length of the map.

Example

// 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.)";
}

Sample Output

The following output is for x86.

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

Requirements

Header: <map>

Namespace: std

See Also

Reference

map Class

map::max_size, map::clear, map::erase, and map::size

Standard Template Library

Other Resources

map Members