<<< Declaring iterators | Index | Container functions returning iterators >>> |
begin( ) and end( ) provide special iterators for a vector:
using std::vector;
vector< int > v1;
//...
int total = 0;
vector< int >::const_iterator iter = v1.begin();
while ( iter != v1.end() ) {
total += *iter;
++iter;
}
<<< Declaring iterators | Index | Container functions returning iterators >>> |