hash_set::begin
[!UWAGA]
Ten interfejs API jest nieaktualny.Alternatywą jest unordered_set — Klasa.
Zwraca iterację, którego dotyczy pierwszy element w hash_set.
const_iterator begin( ) const;
iterator begin( );
Wartość zwracana
Adresowanie pierwszym elementem hash_set lub lokalizacji kolejnego pustego hash_set sterująca dwukierunkowy.
Uwagi
Jeśli wartość zwracaną przez rozpocząć jest przypisany do const_iterator, nie można modyfikować elementów w obiekcie hash_set.Jeśli wartość zwracaną przez rozpocząć jest przypisany do sterująca, można modyfikować elementów w obiekcie hash_set.
W Visual C++ .NET 2003, elementy członkowskie plików nagłówka <hash_map> i <hash_set> nie są już w przestrzeni nazw std, ale raczej zostały przeniesione do przestrzeni nazw stdext.Zobacz Przestrzeń nazw stdext, aby uzyskać więcej informacji.
Przykład
// hash_set_begin.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_set <int> hs1;
hash_set <int>::iterator hs1_Iter;
hash_set <int>::const_iterator hs1_cIter;
hs1.insert( 1 );
hs1.insert( 2 );
hs1.insert( 3 );
hs1_Iter = hs1.begin( );
cout << "The first element of hs1 is " << *hs1_Iter << endl;
hs1_Iter = hs1.begin( );
hs1.erase( hs1_Iter );
// The following 2 lines would err because the iterator is const
// hs1_cIter = hs1.begin( );
// hs1.erase( hs1_cIter );
hs1_cIter = hs1.begin( );
cout << "The first element of hs1 is now " << *hs1_cIter << endl;
}
Wymagania
Nagłówek: <hash_set>
Przestrzeń nazw: stdext