=====begin=====
Syntax:
#include
iterator begin();
const_iterator begin() const;
The function begin() returns an iterator to the first element of the set. begin
() should run in [[/complexity|constant time]].
For example, the following code uses begin() to initialize an iterator that is
used to enumerate a set:
// Create a set of characters
set charSet;
const char* s = "Hello There";
for( int i=0; i < strlen(s); i++ ) {
charSet.insert( s[i] );
}
// Display the set
set::iterator theIterator;
for( theIterator = charSet.begin(); theIterator != charSet.end(); theIterator++ ) {
cout << *theIterator;
}
// output is " HTehlor"
Related Topics: [[end]], [[rbegin]], [[rend]]