다음을 통해 공유


hash_multimap::key_comp

[!참고]

이 API는 사용되지 않습니다.대신 unordered_multimap Class.

순서 키에 있는 hash_multimap에 사용 되는 비교 개체의 복사본을 검색 합니다.

key_compare key_comp( ) const;

반환 값

Hash_multimap를 사용 하 여 요소를 정렬 하는 함수 개체를 반환 합니다.

설명

저장 된 개체 멤버 함수를 정의합니다.

bool operator(const Key& _Leftconst 키 & _Right**);**

반환 true 경우 _Left 앞에 같지 않은 경우 _Right 정렬 순서에서입니다.

Visual C++.NET 2003 멤버는 <hash_map><hash_set> 헤더 파일이 더 이상 std 네임 스페이스에 있지만 오히려 stdext 네임 스페이스로 이동 되었습니다.자세한 내용은 stdext 네임스페이스를 참조하십시오.

예제

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

int main( )
{
   using namespace std;
   using namespace stdext;
   
   hash_multimap <int, int, hash_compare<int, less<int> > > hm1;
   hash_multimap <int, int, hash_compare<int, less<int> > 
      >::key_compare kc1 = hm1.key_comp( ) ;
   bool result1 = kc1( 2, 3 ) ;
   if( result1 == true )
   {
      cout << "kc1( 2,3 ) returns value of true,\n"
           << "where kc1 is the function object of hm1.\n"
           << endl;
   }
   else   
   {
      cout << "kc1( 2,3 ) returns value of false,\n"
           << "where kc1 is the function object of hm1.\n"
           << endl;
   }

   hash_multimap <int, int, hash_compare<int, greater<int> > > hm2;
   hash_multimap <int, int, hash_compare<int, greater<int> > 
      >::key_compare kc2 = hm2.key_comp( );
   bool result2 = kc2( 2, 3 ) ;
   if( result2 == true )
   {
      cout << "kc2( 2,3 ) returns value of true,\n"
           << "where kc2 is the function object of hm2."
           << endl;
   }
   else   
   {
      cout << "kc2( 2,3 ) returns value of false,\n"
           << "where kc2 is the function object of hm2."
           << endl;
   }
}

Output

kc1( 2,3 ) returns value of true,
where kc1 is the function object of hm1.

kc2( 2,3 ) returns value of false,
where kc2 is the function object of hm2.

요구 사항

헤더: <hash_map>

네임 스페이스: stdext

참고 항목

참조

hash_multimap Class

표준 템플릿 라이브러리