共用方式為


set::max_size

Returns the maximum length of the set.

size_type max_size( ) const;

Return Value

The maximum possible length of the set.

Example

// set_max_size.cpp
// compile with: /EHsc
#include <set>
#include <iostream>

int main( )
{
   using namespace std;   
   set <int> s1;
   set <int>::size_type i;

   i = s1.max_size( );   
   cout << "The maximum possible length "
        << "of the set is " << i << "." << endl;
}

Sample Output

The following output is for x86.

The maximum possible length of the set is 1073741823.

Requirements

Header: <set>

Namespace: std

See Also

Reference

set Class

set::max_size (STL Samples)

Standard Template Library