hash_multiset::lower_bound
[!NOT]
Bu API artık kullanılmıyor.Alternatif unordered_multiset Class.
Belirtilen anahtar daha büyük veya eşit bir anahtara sahip bir hash_multiset ilk öğe için bir yineleyici döndürür.
const_iterator lower_bound(
const Key& _Key
) const;
iterator lower_bound(
const Key& _Key
);
Parametreler
- _Key
Hash_multiset Aranan öğeden sıralama anahtarı ile karşılaştırıldığında bağımsız değişken anahtarı.
Dönüş Değeri
Bir Yineleyici veya const_iterator eşit veya bu değerden bağımsız değişken anahtar veya anahtar için eşleşme bulunursa, hash_multiset'deki son öğe izleyen konum adresleri anahtar ile bir hash_multiset ilk öğenin konumunu adresleri.
Notlar
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_lower_bound.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main() {
using namespace std;
using namespace stdext;
hash_multiset <int> hms1;
hash_multiset <int> :: const_iterator hms1_AcIter, hms1_RcIter;
hms1.insert( 10 );
hms1.insert( 20 );
hms1.insert( 30 );
hms1_RcIter = hms1.lower_bound( 20 );
cout << "The element of hash_multiset hms1 with a key of 20 is: "
<< *hms1_RcIter << "." << endl;
hms1_RcIter = hms1.lower_bound( 40 );
// If no match is found for the key, end( ) is returned
if ( hms1_RcIter == hms1.end( ) )
cout << "The hash_multiset hms1 doesn't have an element "
<< "with a key of 40." << endl;
else
cout << "The element of hash_multiset hms1 with a key of 40 is: "
<< *hms1_RcIter << "." << endl;
// An element at a specific location in the hash_multiset can be found
// by using a dereferenced iterator that addresses the location
hms1_AcIter = hms1.end( );
hms1_AcIter--;
hms1_RcIter = hms1.lower_bound( *hms1_AcIter );
cout << "The element of hms1 with a key matching "
<< "that of the last element is: "
<< *hms1_RcIter << "." << endl;
}
Çıktı
The element of hash_multiset hms1 with a key of 20 is: 20.
The hash_multiset hms1 doesn't have an element with a key of 40.
The element of hms1 with a key matching that of the last element is: 30.
Gereksinimler
Başlık: <hash_set>
Ad alanı: stdext