vector vs string for binary data

后端 未结 9 2168
日久生厌
日久生厌 2020-12-05 07:25

Which is a better c++ container for holding and accessing binary data?

std::vector

or

std::string
         


        
9条回答
  •  粉色の甜心
    2020-12-05 07:54

    You should prefer std::vector over std::string. In common cases both solutions can be almost equivalent, but std::strings are designed specifically for strings and string manipulation and that is not your intended use.

提交回复
热议问题