What is the past-the-end iterator in STL C++?

后端 未结 5 1818
情书的邮戳
情书的邮戳 2020-11-29 01:56

Any one could explain me what is the meaning of past-the-end. Why we call end() function past-the-end?

5条回答
  •  情歌与酒
    2020-11-29 02:28

    Because it doesn't point to the last element of a container, but to somewhere past the last element of a container.

    If you dereference end() it results in undefined behaviour.

提交回复
热议问题