다음을 통해 공유


hash_multiset::key_comp

[!참고]

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

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

key_compare key_comp( ) const;

반환 값

Hash_multiset 템플릿 매개 변수를 반환 합니다. Traits를 해시 하 고 컨테이너의 요소를 정렬 하는 데 사용 되는 함수 개체를 포함 합니다.

에 대 한 자세한 내용은 Traits 참조 된 hash_multiset Class 항목.

설명

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

부울 연산자(const 키 & _xVal, const 키 & _yVal);

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

이때 두 key_comparevalue_compare 템플릿 매개 변수에 대 한 동의어는 성분.두 형식 모두 hash_multiset 및 위치 구분 되는 동일 하 게, hash_map 및 hash_multimap 클래스와 호환 되는 hash_multiset 클래스에 대해 제공 됩니다.

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

예제

// hash_multiset_key_comp.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>

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

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

Output

kc1( 2,3 ) returns value of true, where kc1 is the function object of hms1.
kc2( 2,3 ) returns value of false, where kc2 is the function object of hms2.

요구 사항

헤더: <hash_set>

네임 스페이스: stdext

참고 항목

참조

hash_multiset Class

표준 템플릿 라이브러리