We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

list::max_size

Returns the maximum length of a list.

size_type max_size( ) const;

The maximum possible length of the list.

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

The following output is for x86.

Maximum possible length of the list is 1073741823.

Header: <list>

Namespace: std

Show: