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

后端 未结 5 1820
情书的邮戳
情书的邮戳 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:38

    Like interval in mathematics, stl uses [begin, end).

    That's why we could write for (auto it = v.begin(); it != v.end(); ++it)

提交回复
热议问题