hash_map::begin
[!NOT]
Bu API artık kullanılmıyor.Alternatif unordered_map Class.
Hash_map ilk öğe adresleme bir yineleyici döndürür.
const_iterator begin( ) const;
iterator begin( );
Dönüş Değeri
İlk öğe hash_map veya boş bir hash_map izleyen konum adresleme çift yönlü Yineleyici.
Açıklama
Dönüş değerini başlayan için atanan bir const_iterator, hash_map nesnesi içindeki öğeler değiştirilemez.Dönüş değerini başlamak atanmış bir Yineleyici, hash_map nesnesi içindeki öğeleri değiştirilebilir.
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_map_begin.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_map <int, int> hm1;
hash_map <int, int> :: iterator hm1_Iter;
hash_map <int, int> :: const_iterator hm1_cIter;
typedef pair <int, int> Int_Pair;
hm1.insert ( Int_Pair ( 0, 0 ) );
hm1.insert ( Int_Pair ( 1, 1 ) );
hm1.insert ( Int_Pair ( 2, 4 ) );
hm1_cIter = hm1.begin ( );
cout << "The first element of hm1 is "
<< hm1_cIter -> first << "." << endl;
hm1_Iter = hm1.begin ( );
hm1.erase ( hm1_Iter );
// The following 2 lines would err because the iterator is const
// hm1_cIter = hm1.begin ( );
// hm1.erase ( hm1_cIter );
hm1_cIter = hm1.begin( );
cout << "The first element of hm1 is now "
<< hm1_cIter -> first << "." << endl;
}
Gereksinimler
Başlık: <hash_map>
Ad alanı: stdext