Appendix B. Generic Algorithms Handbook

Each generic algorithm, with the fistful of exceptions that make the rule, begins with a pair of iterators that marks the range of elements within the container over which to traverse. The range begins with the first iterator and ends with but does not include the second:

const int array_size = 7; 
int iarray[array_size] = { 1, 10, 8, 4, 3, 14, 8 }; 
vector<int> vec( iarray, iarray+ array_size ); 

vector<int>::iterator it = find( vec.begin(), vec.end(), value ); 
int *pi = find( iarray, iarray+array_size, value ); 

The algorithms are generally overloaded to support two versions: one that uses either the built-in ...

Get Essential C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.