다음을 통해 공유


hash_multimap::count (STL/CLR)

지정 된 키와 일치 하는 요소의 수를 찾습니다.

    size_type count(key_type key);

매개 변수


  • 검색할 키 값입니다.

설명

에 해당 하는 순서는 제어 되는 시퀀스의 요소 개수를 반환 하는 멤버 함수 key.이를 통해 현재 제어되는 시퀀스에 있는 요소 중 지정된 키와 일치하는 요소의 수를 확인할 수 있습니다.

예제

// cliext_hash_multimap_count.cpp 
// compile with: /clr 
#include <cliext/hash_map> 
 
typedef cliext::hash_multimap<wchar_t, int> Myhash_multimap; 
int main() 
    { 
    Myhash_multimap c1; 
    c1.insert(Myhash_multimap::make_value(L'a', 1)); 
    c1.insert(Myhash_multimap::make_value(L'b', 2)); 
    c1.insert(Myhash_multimap::make_value(L'c', 3)); 
 
// display contents " [a 1] [b 2] [c 3]" 
    for each (Myhash_multimap::value_type elem in c1) 
        System::Console::Write(" [{0} {1}]", elem->first, elem->second); 
    System::Console::WriteLine(); 
 
    System::Console::WriteLine("count(L'A') = {0}", c1.count(L'A')); 
    System::Console::WriteLine("count(L'b') = {0}", c1.count(L'b')); 
    System::Console::WriteLine("count(L'C') = {0}", c1.count(L'C')); 
    return (0); 
    } 
 
  

요구 사항

헤더: < cliext/hash_map >

네임 스페이스: cliext

참고 항목

참조

hash_multimap (STL/CLR)

hash_multimap::equal_range (STL/CLR)