Introduction to OOP: Chapter 16 : A Case Study : The STL [next] [previous] [audio] [real] [text]

What must iterators do

To see what iterators must do, consider a typical algorithm:

	template <class T>
	iterator find 
		(iterator first, iterator last, T & value)
		while (first != last && *first != value) ++first;
		return first;

Could be used to find values in an array, or in a list:

int data[100];
int * where = find(data, data+100, 7);
list<int>::iterator where = find(aList.begin(), aList.end(), 7);
Intro OOP, Chapter 16, Slide 7