Syntax:
#include <string> iterator begin(); const_iterator begin() const;
begin()関数は、文字列の最初の要素を指すイテレータを返します。 begin()関数は、一定時間で処理されます。 たとえば、次のコードでは、リストの初期化にbegin()から得られるイテレータを使っています。
// Create a list of characters list<char> charList; for( int i=0; i < 10; i++ ) { charList.push_front( i + 65 ); } // Display the list list<char>::iterator theIterator; for( theIterator = charList.begin(); theIterator != charList.end(); ++theIterator ) { cout << *theIterator; }