hash_multiset::value_comp
[!POZNÁMKA]
Toto rozhraní API je zastaralé.Alternativou je unordered_multiset – třída.
Získá kopii objektu porovnání používá pořadí hodnot prvku hash_multiset.
value_compare value_comp( ) const;
Vrácená hodnota
Vrátí parametr šablony hash_multiset Traits, který obsahuje funkce objekty, které používají hodnoty hash a pořadí prvků kontejneru.
Další informace o Traits najdete hash_multiset – třída téma.
Poznámky
Uložené objektu definuje členskou funkci:
bool operator(const Key& _xVal, const Key& _yVal);
která vrátí true li _xVal předchází a není rovno _yVal v pořadí řazení.
Všimněte si, že obě key_compare a value_compare jsou synonyma pro parametr šablony znaky.Oba typy jsou k dispozici pro hash_multiset a hash_multiset třídy, jsou-li shodné pro kompatibilitu s hash_map a hash_multimap tříd, kde se liší.
V aplikaci Visual C++ .NET 2003, členové hlavičkových souborů tříd <hash_map> a <hash_set> již nejsou v oboru názvů std, ale byly přesunuty do oboru názvů stdext.Další informace naleznete v tématu Obor názvů stdext.
Příklad
// 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;
}
}
Požadavky
Záhlaví:<hash_set>
Obor názvů: stdext