C++ Iterator dereference and prefix increment/decrement style? Is *--Iter ok style wise?

后端 未结 4 1663
[愿得一人]
[愿得一人] 2021-01-22 22:56

In coding with C++ iterators if you wanted to get the previous value to what an iterator points to would you write:

*--Iter

or would you think

4条回答
  •  庸人自扰
    2021-01-22 23:22

    Even if you get one of these to work as you expect, they're both hard to read. Does this have to be done in a single statement?

提交回复
热议问题