In article <on********************@news2.central.cox.net>,
sk*****@hotmail.com says...
Consider the following:
list<int> a; // assume a contains some number of integers
list<int>::iterator iter = a.find(10);
for (iter; iter < a.end(); ++iter)
{
std::cout << "found one\n";
}
Many of the comments you've received have had little to do with the
questions you asked -- this is worse: it has _nothing_ to do with the
questions you asked! <G>
I'd use something like this:
void show() {
std::cout << "found one\n";
}
std::for_each(a.find(10), a.end(), show);
Remember: there's a reason for_each (among other things) takes two
iterators instead of just the name of a container -- it isn't just to
irritate you, but to allow for situations like this, where you want to
start iterating from somewhere in the middle of a collection instead of
from the beginning.
You might also want to consider the boost::lambda library to obviate
creating the show() function.
--
Later,
Jerry.
The universe is a figment of its own imagination.