다음을 통해 공유


set::value_comp

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

value_compare value_comp( ) const;

반환 값

템플릿 매개 변수는 집합의 요소 순서를 사용 하 여 함수 개체를 반환 Traits.

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

설명

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

bool operator(const Key&_xVal, const Key&_yVal);

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

이때 모두 value_comparekey_compare 동의어에 대 한 템플릿 매개 변수는 특성.두 형식 집합과 구분 되는, 지도 multimap 클래스와의 호환성에 대 한 동일 multiset 클래스를 제공 합니다.

예제

// set_value_comp.cpp
// compile with: /EHsc
#include <set>
#include <iostream>

int main( )
{
   using namespace std;
   
   set <int, less<int> > s1;
   set <int, less<int> >::value_compare vc1 = s1.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 s1."
           << endl;
   }
   else   
   {
      cout << "vc1( 2,3 ) returns value of false, "
           << "where vc1 is the function object of s1."
           << endl;
   }

   set <int, greater<int> > s2;
   set<int, greater<int> >::value_compare vc2 = s2.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 s2."
           << endl;
   }
   else   
   {
      cout << "vc2( 2,3 ) returns value of false, "
           << "where vc2 is the function object of s2."
           << endl;
   }
}
  
  

요구 사항

헤더: <set>

네임 스페이스: std

참고 항목

참조

set Class

set::key_comp 및 set::value_comp

표준 템플릿 라이브러리