Aracılığıyla paylaş


hash_multimap::value_comp

[!NOT]

Bu API artık kullanılmıyor.Alternatif unordered_multimap Class.

Üye işlev anahtar değerleri karşılaştırarak bir hash_multimap içindeki öğelerin sırasını belirleyen bir işlev nesnesi döndürür.

value_compare value_comp( ) const;

Dönüş Değeri

Bir hash_multimap kendi öğeleri sipariş etmek için kullandığı karşılaştırma işlevi nesnesi döndürür.

Notlar

Bir hash_multimap için m, iki öğe e1 (k1*, d1) ve e2 (k2, d*2) nesne türü olan value_type, burada k1 ve k2 anahtarlarını türü olan key_type ve d1 ve d2, veri türü olan mapped_type, sonra m.value_comp( )(e1, e2) is equivalent to m.key_comp( ) (k1, k2).Saklı nesnenin üye işlevini tanımlar.

Boole işleci(value_type &_Left, value_type & _Right);

döndüren doğru , anahtar değeri _Left önce gelir ve anahtar değerine eşit değil _Right sıralama düzeninde.

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_multimap_value_comp.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   
   hash_multimap <int, int, hash_compare<int, less<int> > > hm1;
   hash_multimap <int, int, hash_compare<int, less<int> > 
      >::value_compare vc1 = hm1.value_comp( );
   hash_multimap <int,int>::iterator Iter1, Iter2;
   
   Iter1= hm1.insert ( hash_multimap <int, int> :: value_type ( 1, 10 ) );
   Iter2= hm1.insert ( hash_multimap <int, int> :: value_type ( 2, 5 ) );

   if( vc1( *Iter1, *Iter2 ) == true )
   {
      cout << "The element ( 1,10 ) precedes the element ( 2,5 )."
           << endl;
   }
   else   
   {
      cout << "The element ( 1,10 ) does "
           << "not precede the element ( 2,5 )."
           << endl;
   }

   if( vc1( *Iter2, *Iter1 ) == true )   
   {
      cout << "The element ( 2,5 ) precedes the element ( 1,10 )."
           << endl;
   }
   else   
   {
      cout << "The element ( 2,5 ) does "
           << "not precede the element ( 1,10 )."
           << endl;
   }
}

Çıktı

The element ( 1,10 ) precedes the element ( 2,5 ).
The element ( 2,5 ) does not precede the element ( 1,10 ).

Gereksinimler

Başlık: <hash_map>

Ad alanı: stdext

Ayrıca bkz.

Başvuru

hash_multimap Class

Standart Şablon Kütüphanesi