Compartir a través de


hash_map::cend

Returns a const iterator that addresses the location succeeding the last element in a hash_map.

const_iterator cend( ) const;

Return Value

A const bidirectional iterator that addresses the location succeeding the last element in a hash_map Class. If the hash_map is empty, then hash_map::cend == hash_map::begin.

Remarks

cend is used to test whether an iterator has reached the end of its hash_map.

The value returned by cend should not be dereferenced.

In Visual C++ .NET 2003, members of the <hash_map> and <hash_set> header files are no longer in the std namespace, but rather have been moved into the stdext namespace. See The stdext Namespace for more information.

Example

// hash_map_cend.cpp
// compile with: /EHsc
#define _DEFINE_DEPRECATED_HASH_CLASSES 0
#include <hash_map>
#include <iostream>

int main( ) 
{
   using namespace std;
   using namespace stdext;
   hash_map <int, int> hm1;

   hash_map <int, int> :: const_iterator hm1_cIter;
   typedef pair <int, int> Int_Pair;

   hm1.insert ( Int_Pair ( 3, 30 ) );

   hm1_cIter = hm1.cend( );
   hm1_cIter--;
   cout << "The value of last element of hm1 is " 
        << hm1_cIter -> second << "." << endl;
   }
The value of last element of hm1 is 30.

Requirements

Header: <hash_map>

Namespace: stdext

See Also

Reference

hash_map Class

Standard Template Library

Other Resources

hash_map Members