Is begin() == end() for any empty() vector?

后端 未结 4 1209
花落未央
花落未央 2020-12-15 02:19

I have long assumed that for any empty std::vector V, V.begin() == V.end(). Yet I see nothing in the C++ specification that states this to

4条回答
  •  感动是毒
    2020-12-15 02:48

    Yes, that is true. Here is the proof. And, of course, std::distance(a.begin(), a.end()) == 0 for an empty vector.

提交回复
热议问题