Поделиться через


hash_set::cend

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

const_iterator cend( ) const;

Return Value

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

Remarks

cend is used to test whether an iterator has reached the end of its hash_set. 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_set_cend.cpp
// compile with: /EHsc
#define _DEFINE_DEPRECATED_HASH_CLASSES 0
#include <hash_set>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_set <int> hs1;
   hash_set <int> :: const_iterator hs1_cIter;
   
   hs1.insert( 1 );
   hs1.insert( 2 );
   hs1.insert( 3 );

   hs1_cIter = hs1.cend( );
   hs1_cIter--;
   cout << "The last element of hs1 is " << *hs1_cIter << endl;
}
The last element of hs1 is 3

Requirements

Header: <hash_set>

Namespace: stdext

See Also

Reference

hash_set Class

Standard Template Library

Other Resources

hash_set Members