hash_multiset::begin
Returns an iterator that addresses the first element in the hash_multiset.
const_iterator begin( ) const;
iterator begin( );
Return Value
A bidirectional iterator addressing the first element in the hash_multiset or the location succeeding an empty hash_multiset.
Remarks
If the return value of begin is assigned to a const_iterator, the elements in the hash_multiset object cannot be modified. If the return value of begin is assigned to an iterator, the elements in the hash_multiset object can be modified.
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_multiset_begin.cpp
// compile with: /EHsc
#define _DEFINE_DEPRECATED_HASH_CLASSES 0
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multiset <int> hms1;
hash_multiset <int>::iterator hms1_Iter;
hash_multiset <int>::const_iterator hms1_cIter;
hms1.insert( 1 );
hms1.insert( 2 );
hms1.insert( 3 );
hms1_Iter = hms1.begin( );
cout << "The first element of hms1 is " << *hms1_Iter << endl;
hms1_Iter = hms1.begin( );
hms1.erase( hms1_Iter );
// The following 2 lines would err because the iterator is const
// hms1_cIter = hms1.begin( );
// hms1.erase( hms1_cIter );
hms1_cIter = hms1.begin( );
cout << "The first element of hms1 is now " << *hms1_cIter << endl;
}
The first element of hms1 is 1 The first element of hms1 is now 2
Requirements
Header: <hash_set>
Namespace: stdext