list::max_size

Returns the maximum length of a list.

size_type max_size( ) const;

Return Value

The maximum possible length of the list.

Example

// list_max_size.cpp
// compile with: /EHsc
#include <list>
#include <iostream>

int main( ) 
{
   using namespace std;
   list <int> c1;
   list <int>::size_type i;

   i = c1.max_size( );
   cout << "Maximum possible length of the list is " << i << "." << endl;
}

Sample Output

The following output is for x86.

Maximum possible length of the list is 1073741823.

Requirements

Header: <list>

Namespace: std

See Also

Reference

list Class

Standard Template Library

Other Resources

list Class Members