Sdílet prostřednictvím


hash_multimap::end

[!POZNÁMKA]

Toto rozhraní API je zastaralé.Alternativou je unordered_multimap – třída.

Vrátí iterátor, který řeší umístění následných posledního prvku hash_multimap.

const_iterator end( ) const; 
iterator end( );

Vrácená hodnota

Obousměrný iterátor, který řeší umístění následných posledního prvku hash_multimap.Je-li hash_multimap prázdná, hash_multimap::end == hash_multimap::begin.

Poznámky

Konec se používá k testování zda iterátor dosáhl konce svého hash_multimap.

Hodnotu vrácenou Konec by neměla být přímo odkázat.

V aplikaci Visual C++ .NET 2003, členové hlavičkových souborů tříd <hash_map> a <hash_set> již nejsou v oboru názvů std, ale byly přesunuty do oboru názvů stdext.Další informace naleznete v tématu Obor názvů stdext.

Příklad

// 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;
}
  

Požadavky

Hlavička: <hash_map>

Obor názvů: stdext

Viz také

Referenční dokumentace

hash_multimap – třída

Standardní knihovna šablon