Overview

How begin and end are used in range-for statements.

The rules (from TC++PL4)

The expression after the colon must denote a sequence (a range); that is, it must yield a value for which we can call v.begin() and v.end() or begin(v) and end(v) to obtain iterators (§4.5):

Add more regarding standard library header <iterator>.