c++ empty std::vector begin not equals to end

前端 未结 3 1829
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 16:33

Hi I have situation on windows 10, that declared empty class member variable vector, but this vector\'s begin()(first iterator) and end()(last iterator)

3条回答
  •  臣服心动
    2021-01-29 17:21

    The standard only requires that the iterators are equal, not that their adresses are the same. Considering the adresses of iterators is pointless.

    As other have stated, the two iterators are different objects, so they need to have different adresses.

    For reference, see this answer.

提交回复
热议问题