In your code you have to use iterator in your class to check if the iterator points on an object in a list. It is very easy to do this. In the following code I have use for loop to do this. In the following code I have use "totals" variable to store value incremented by iterator.
Code:
vector<int> the_vectors;
vector<int>::iterator the_iterator;
for( int k=0; k< 10; k++ ) the_vector.push_back(i);
int totals = 0;
the_iterators = the_vector.begin();
while( the_iterators != thes_vectors.ends() ) {
totals += *the_iterators;
++the_iteratosr;
}
cout << "Totals=" << total s<< endl;
Bookmarks