다음을 통해 공유


hash_set::value_comp

[!참고]

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

순서는 hash_set 요소 값을 사용한 비교 개체의 복사본을 검색 합니다.

value_compare value_comp( ) const;

반환 값

템플릿 매개 변수는 해당 요소의 순서는 hash_set를 사용 하 여 함수 개체를 반환 Compare.

에 대 한 자세한 내용은 Compare, 설명 부분을 참조를 hash_set Class 항목.

설명

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

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

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

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

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

예제

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

int main( )
{
   using namespace std;
   using namespace stdext;
   
   hash_set <int, hash_compare < int, less<int> > > hs1;
   hash_set <int, hash_compare < int, less<int> >  >::value_compare
      vc1 = hs1.value_comp( );
   bool result1 = vc1( 2, 3 );
   if( result1 == true )
   {
      cout << "vc1( 2,3 ) returns value of true, "
           << "where vc1 is the function object of hs1."
           << endl;
   }
   else
   {
      cout << "vc1( 2,3 ) returns value of false, "
           << "where vc1 is the function object of hs1."
           << endl;
   }

   hash_set <int, hash_compare < int, greater<int> > > hs2;
   hash_set<int, hash_compare < int, greater<int> > >::value_compare
      vc2 = hs2.value_comp( );
   bool result2 = vc2( 2, 3 );
   if( result2 == true )
   {
      cout << "vc2( 2,3 ) returns value of true, "
           << "where vc2 is the function object of hs2."
           << endl;
   }
   else
   {
      cout << "vc2( 2,3 ) returns value of false, "
           << "where vc2 is the function object of hs2."
           << endl;
   }
}

Output

vc1( 2,3 ) returns value of true, where vc1 is the function object of hs1.
vc2( 2,3 ) returns value of false, where vc2 is the function object of hs2.

요구 사항

헤더: <hash_set>

네임 스페이스: stdext

참고 항목

참조

hash_set Class

표준 템플릿 라이브러리