hash_multimap::end
[!UWAGA]
Ten interfejs API jest nieaktualny.Alternatywą jest unordered_multimap — Klasa.
Zwraca iterację, którego dotyczy lokalizacji pomyślne wykonanie ostatniego elementu w hash_multimap.
const_iterator end( ) const;
iterator end( );
Wartość zwracana
Sterująca dwukierunkowe, którego dotyczy lokalizacji pomyślne wykonanie ostatniego elementu w hash_multimap.Jeśli hash_multimap jest pusta, a następnie hash_multimap::end == hash_multimap::begin.
Uwagi
koniec jest używana do sprawdzenia, czy iterację osiągnął koniec jego hash_multimap.
Wartość zwracana przez koniec nie należy usunąć odwołania.
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_multimap_end.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multimap <int, int> hm1;
hash_multimap <int, int> :: iterator hm1_Iter;
hash_multimap <int, int> :: const_iterator hm1_cIter;
typedef pair <int, int> Int_Pair;
hm1.insert ( Int_Pair ( 1, 10 ) );
hm1.insert ( Int_Pair ( 2, 20 ) );
hm1.insert ( Int_Pair ( 3, 30 ) );
hm1_cIter = hm1.end( );
hm1_cIter--;
cout << "The value of last element of hm1 is "
<< hm1_cIter -> second << "." << endl;
hm1_Iter = hm1.end( );
hm1_Iter--;
hm1.erase ( hm1_Iter );
// The following 2 lines would err because the iterator is const
// hm1_cIter = hm1.end ( );
// hm1_cIter--;
// hm1.erase ( hm1_cIter );
hm1_cIter = hm1.end( );
hm1_cIter--;
cout << "The value of last element of hm1 is now "
<< hm1_cIter -> second << "." << endl;
}
Wymagania
Nagłówek: <hash_map>
Przestrzeń nazw: stdext