June 2017
Intermediate to advanced
532 pages
12h 59m
English
Consider that we write the following code:
for (auto x : range) { code_block; }
The compiler will evaluate it to the following:
{ auto __begin = std::begin(range); auto __end = std::end(range); for ( ; __begin != __end; ++__begin) { auto x = *__begin; code_block } }
While looking at this code, it becomes obvious that the only requirements for the iterators are the following three operators:
The requirements of the range are that it has a begin and an end method, which return two iterators that denote the beginning and the end of a range.
Read now
Unlock full access