다음을 통해 공유


hash_map::find (STL/CLR)

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

    iterator find(key_type key);

매개 변수


  • 검색할 키 값입니다.

설명

제어 되는 시퀀스에 요소가 한 개 이상에 해당 하는 주문 경우 key, 멤버 함수; 요소 중 하나를 지정 하는 반복기를 반환 합니다. 그렇지 않으면 hash_map::end (STL/CLR)().제어 시퀀스에서 지정 된 키와 일치 하는 현재 요소를 찾는 데 사용 합니다.

예제

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

설명

참고 find 발견 몇 가지 요소는 보장 하지 않습니다.

요구 사항

헤더: < cliext/hash_map >

네임 스페이스: cliext

참고 항목

참조

hash_map (STL/CLR)

hash_map::equal_range (STL/CLR)

hash_map::lower_bound (STL/CLR)

hash_map::upper_bound (STL/CLR)