Is it allowed to increment an end iterator?

前端 未结 1 1583
清酒与你
清酒与你 2020-12-10 05:55

Is it allowed to increment an iterator variable it that already is at end(), i.e. auto it = v.end()?

  • Is it allowed in ge
相关标签:
1条回答
  • 2020-12-10 06:16

    No the behaviour is undefined. You are allowed to set an iterator to end(), but you must not increment it or dereference it.

    You are allowed to decrement it so long as the backing container is not empty.

    0 讨论(0)
提交回复
热议问题