(C++)为什么需要反向迭代器?
PHP中文网
PHP中文网 2017-04-17 13:53:20
0
2
332

RT。为什么不可以用正向迭代器进行反向遍历?
求各位指点。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
巴扎黑

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.

刘奇

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template