hash_multiset::value_comp
참고
이 API는 사용되지 않습니다.unordered_multiset 클래스를 대신 사용하는 것이 좋습니다.
Retrieves a copy of the comparison object used to order element values in a hash_multiset.
value_compare value_comp( ) const;
반환 값
Returns the hash_multiset template parameter Traits, which contains function objects that are used to hash and to order elements of the container.
자세한 내용은 Traits 의 hash_multiset 클래스 항목을 참조하십시오.
설명
The stored object defines a member function:
bool operator(const Key& _xVal, const Key& _yVal);
which returns true if _xVal precedes and is not equal to _yVal in the sort order.
Note that both key_compare and value_compare are synonyms for the template parameter Traits. Both types are provided for the hash_multiset and hash_multiset classes, where they are identical, for compatibility with the hash_map and hash_multimap classes, where they are distinct.
Visual C++.NET 2003에서, <hash_map> 및 <hash_set> 헤더 파일의 멤버는 더 이상 std 네임스페이스에 존재하지 않습니다. 대신 stdext 네임스페이스로 이동되었습니다. 자세한 내용은 stdext 네임스페이스를 참조하십시오.
예제
// hash_multiset_value_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> > >::value_compare
vc1 = hms1.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 hms1."
<< endl;
}
else
{
cout << "vc1( 2,3 ) returns value of false, "
<< "where vc1 is the function object of hms1."
<< endl;
}
hash_multiset <int, hash_compare < int, greater<int> > > hms2;
hash_multiset<int, hash_compare < int, greater<int> > >::
value_compare vc2 = hms2.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 hms2."
<< endl;
}
else
{
cout << "vc2( 2,3 ) returns value of false, "
<< "where vc2 is the function object of hms2."
<< endl;
}
}
요구 사항
헤더: <hash_set>
네임스페이스: stdext