January 2018
Intermediate to advanced
374 pages
9h 53m
English
Now that we covered the basics of iterators, let's see how C++ implements it syntactically. As mentioned above, the syntax of C++ iterators are implemented in terms of standard C pointer notation. This means that any algorithm built upon iterators will also work with regular C pointers.
The step functions are implemented using pointer arithmetic. The following table shows which operator is overloaded for each step function, and how to invoke the function on an imagined iterator object called it:
| Denoted function | Overloaded operator | Usage example |
| step_fwd() -> void; | operator++() | ++it; |
| step_bwd() -> void; | operator--() | --it; |
| step(int n) -> void; | operator+=(int n) | it += 5; |
The read() and write() functions ...