Benefits of vector over string?

后端 未结 7 1502
自闭症患者
自闭症患者 2020-12-14 09:52

This question is related to, but not quite the same as, this question.

Are there any benefits to using std::vector instead of std::str

7条回答
  •  盖世英雄少女心
    2020-12-14 10:00

    I think the only benefit you would gain from doing that would the ease of incrementing over the std::vector of characters, but even that can be done with an std::string.

    You have to remember that even though std::string seems like an object, it can be accessed like an array, so even accessing specific parts of a string can be done without the use of a std::vector

提交回复
热议问题