Benefits of vector<char> over string?
c++, stl, string, vector
Solution
Yes, `vector<char>` indeed does have more capabilities over `string`.
Unlike `string`, `vector<char>` is guaranteed to preserve iterators, references, etc. during a `swap` operation. See: May `std::vector` make use of small buffer optimization?
Problem
This question is related to, but not quite the same as, this question. Are there any benefits to using `std::vector<char>` instead of `std::string` to hold arbitrary binary data, aside from readability-related issues? i.e. Are there any tasks which are easier/more efficient/better to perform with a vector compared to a string?