다음을 통해 공유


multiset::value_comp

비교 multiset에 순서 대로 요소 값으로 사용할 개체의 복사본을 검색 합니다.

value_compare value_comp( ) const;

반환 값

템플릿 매개 변수인 multiset의 요소 순서를 사용 하 여 함수 개체를 반환 Compare.

에 대 한 자세한 내용은 Compare, 설명 절을 참조 하십시오의 multiset Class 항목.

설명

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

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

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

이때 모두 key_comparevalue_compare 동의어에 대 한 템플릿 매개 변수는 Compare.두 클래스 집합 및 multiset 위치 동일, multimap, 구분 되는 클래스 구조와 호환성에 대 한 제공 됩니다.

예제

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

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

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

요구 사항

헤더: <set>

네임 스페이스: std

참고 항목

참조

multiset Class

표준 템플릿 라이브러리