Considering this example...
The dereferencing "*the_iterator" is used... Is this another way of accessing the_vector contents? Why not just use the_vector to add to total?Code:vector<int> the_vector;
vector<int>::iterator the_iterator;
for( int i=0; i < 10; i++ )
the_vector.push_back(i);
int total = 0;
the_iterator = the_vector.begin();
while( the_iterator != the_vector.end() )
{
total += *the_iterator;
the_iterator++;
}
cout << "Total=" << total << endl;