Iterator

Applies to: cpp

An iterator is a pointer-like handle to a position in a container. The begin()..end() pair denotes a whole range, the standard interface every STL algorithm (sort, find, min_element) consumes.

auto it = std::min_element(v.begin(), v.end());
double smallest = *it;   // dereference to read the value

See also: std-vector, range-based-for, std-sort