external iterator:
It is a separate class that can step through its container/collection.
So you can control the logic to get the item what you want.
ex.
std::vector<int> v; for(vint::iterator it=v.begin(), it!=v.end(); ++i) std::cout << *it << "\n";
internal iterator:It is implemented with member functions to step through.
You only can get the items in turn, but it is more easy to use than external iterator.
ex.
MACRO_FOREACH(v) { std::cout << v << "\n"; }
沒有留言:
張貼留言