hash_multiset::count
[!참고]
이 API는 사용되지 않습니다.대신 unordered_multiset Class.
키 매개 변수에 지정 된 키와 일치 하는 hash_multiset에서 요소의 개수를 반환 합니다.
size_type count(
const Key& _Key
) const;
매개 변수
- _Key
Hash_multiset에서 일치 하는 요소의 키입니다.
반환 값
Hash_multiset 매개 변수에 지정 된 키를 가진 요소의 수입니다.
설명
다음 범위 내에서 요소의 개수를 반환 하는 멤버 함수:
[lower_bound (_Key ), upper_bound (_Key ) ).
Visual C++.NET 2003 멤버는 <hash_map> 및 <hash_set> 헤더 파일이 더 이상 std 네임 스페이스에 있지만 오히려 stdext 네임 스페이스로 이동 되었습니다.자세한 내용은 stdext 네임스페이스를 참조하십시오.
예제
이 예제를 컴파일하는 경우의 /Wp64 플래그 또는 컴파일러 경고 c 4267은 64 비트 플랫폼에서 생성 됩니다.이 경고에 대 한 내용은 컴파일러 경고 (수준 3) C4267.
// hash_multiset_count.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multiset<int> hms1;
hash_multiset<int>::size_type i;
hms1.insert(1);
hms1.insert(1);
// Keys do not need to be unique in hash_multiset,
// so duplicates may exist.
i = hms1.count(1);
cout << "The number of elements in hms1 with a sort key of 1 is: "
<< i << "." << endl;
i = hms1.count(2);
cout << "The number of elements in hms1 with a sort key of 2 is: "
<< i << "." << endl;
}
요구 사항
헤더: <hash_set>
네임 스페이스: stdext