std::list iterator: get next element

前端 未结 6 1770
情书的邮戳
情书的邮戳 2021-02-08 21:59

I\'m trying to build a string using data elements stored in a std::list, where I want commas placed only between the elements (ie, if elements are {A,B,C,D} in list, result stri

6条回答
  •  猫巷女王i
    2021-02-08 22:29

    I believe that a list iterator is bidirectional, but not random access. That means that you can do ++ and -- to it but not add or subtract.

    To get the next iterator, make a copy and increment it.

提交回复
热议问题