hash_multiset::key_comp
[!NOT]
Bu API artık kullanılmıyor.Alternatif unordered_multiset Class.
Bir hash_multiset sipariş anahtarları için kullanılan karşılaştırma nesnenin bir kopyasını alır.
key_compare key_comp( ) const;
Dönüş Değeri
Hash_multiset şablon parametresi döndürür Traits, karma ve kapsayıcı öğeleri sipariş etmek için kullanılan işlev nesneleri içerir.
Daha fazla bilgi için Traits bkz: hash_multiset Class konu.
Notlar
Saklı nesne üye işlev tanımlar:
Boole işleci(const anahtar & _xVal, const anahtar & _yVal);
döndüren doğru , _xVal önce gelir ve eşit değil _yVal sıralama düzeninde.
Unutmayın, hem de key_compare ve value_compare eşanlamlıdır şablon parametresi için nitelikler.Her iki tür hash_multiset ve hash_multiset sınıfları, birbirinden farklı olduğu hash_map ve hash_multimap sınıfları ile uyumluluk için özdeş oldukları için sağlanmıştır.
Visual C++ .NET 2003, üyeleri de <hash_map> ve <hash_set> başlık dosyaları artık std ad alanında bulunan, ancak bunun yerine stdext ad alanına taşınmış.Bkz: ad stdext daha fazla bilgi için.
Örnek
// hash_multiset_key_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> > >::key_compare kc1
= hms1.key_comp( ) ;
bool result1 = kc1( 2, 3 ) ;
if( result1 == true )
{
cout << "kc1( 2,3 ) returns value of true, "
<< "where kc1 is the function object of hms1."
<< endl;
}
else
{
cout << "kc1( 2,3 ) returns value of false "
<< "where kc1 is the function object of hms1."
<< endl;
}
hash_multiset <int, hash_compare < int, greater<int> > > hms2;
hash_multiset<int, hash_compare < int, greater<int> > >::key_compare
kc2 = hms2.key_comp( ) ;
bool result2 = kc2( 2, 3 ) ;
if( result2 == true )
{
cout << "kc2( 2,3 ) returns value of true, "
<< "where kc2 is the function object of hms2."
<< endl;
}
else
{
cout << "kc2( 2,3 ) returns value of false, "
<< "where kc2 is the function object of hms2."
<< endl;
}
}
Çıktı
kc1( 2,3 ) returns value of true, where kc1 is the function object of hms1.
kc2( 2,3 ) returns value of false, where kc2 is the function object of hms2.
Gereksinimler
Başlık: <hash_set>
Ad alanı: stdext