hash_multimap::size

说明说明

此 API 已过时。另一种方法是 unordered_multimap Class

返回元素数。hash_multimap 的。

size_type size( ) const;

返回值

hash_multimap 的当前长度。

备注

在 Visual C++ .NET 2003 中,<hash_map><hash_set> 标头文件的成员中不再标准,命名空间,而是将 stdext 命名空间。有关更多信息,请参见 stdext 命名空间

示例

当编译此示例与 /Wp64 标记或在 64 位平台时,警告的编译器 C4267 将生成。有关此警告的更多信息,请参见 编译器警告(等级 3)C4267

// hash_multimap_size.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>

int main( )
{
    using namespace std;
    using namespace stdext;
    hash_multimap<int, int> hm1, hm2;
    hash_multimap<int, int>::size_type i;
    typedef pair<int, int> Int_Pair;

    hm1.insert(Int_Pair(1, 1));
    i = hm1.size();
    cout << "The hash_multimap length is " << i << "." << endl;

    hm1.insert(Int_Pair(2, 4));
    i = hm1.size();
    cout << "The hash_multimap length is now " << i << "." << endl;
}
  
  

要求

标头: <hash_map>

命名空间: stdext

请参见

参考

hash_multimap Class

标准模板库