Why can I not convert a reverse iterator to a forward iterator?

前端 未结 3 1510
情话喂你
情话喂你 2021-02-13 22:36

Well, I know why, it\'s because there isn\'t a conversion, but why isn\'t there a conversion? Why can forward iterators be turned to reverse iterators but not the other way roun

3条回答
  •  遇见更好的自我
    2021-02-13 22:48

    You can get forward iterator from reverse iterator using this code

    container.begin() + (reverseIter - container.rbegin() - 1);
    

提交回复
热议问题