c++ - What are differences between std::string and std::vector<char>? -
so main differences , of them used in cases?
vector<char>gives guarantee&v[0]+n == &v[n]whereas string doesn't (practically, case, there no guarantee)... afaik c++0x gives guarantee already- there no implicit conversion
const char*vector<char> - string not stl container. example, has no
pop_back()orback()functions - and last, not least, different member functions! string gives functions suitable strings, returnig null-terminated string
c_str()
bottom line: use string when need operate strings. use vector<char> when need ... well, vector of individual chars...
another use of vector<char> way avoid vector<bool> specialization.
Comments
Post a Comment