备注
此 API 已过时。替代为 unordered_map 类。
返回 hash_map 的最大长度。
size_type max_size( ) const;
返回值
hash_map 的可能的最大长度。
备注
在Visual C++ .NET 2003中,成员<hash_map> 和 <hash_set> 头文件不再在std命名空间,而是已经进入了stdext命名空间。 有关更多信息,请参见 stdext 命名空间。
示例
// hash_map_max_size.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_map <int, int> hm1;
hash_map <int, int> :: size_type i;
i = hm1.max_size( );
cout << "The maximum possible length "
<< "of the hash_map is " << i << "."
<< endl << "(Magnitude is machine specific.)";
}
示例输出
将生成下面关于x86的输出。
The maximum possible length of the hash_map is 536870911.
(Magnitude is machine specific.)
要求
标头: <hash_map>
**命名空间:**stdext