巴扎黑2017-04-17 13:55:20
I think it’s better to derive both forward and reverse iterators
The advantage is
Traversing from any starting point to any end point of the data structure chain can write code in a concise way, without having to think about it and making mistakes easily.
The disadvantage is
In order to save programmers’ brain power, the data structure may become more bloated, the space cost will increase, and the execution efficiency of reverse iterator may not be high.
怪我咯2017-04-17 13:55:20
Tell me your opinion:
auto itr = container.end();
At this point *itr you have crossed the line, end() represents the next position of the last element of your container.