So what are main differences and which of them will be used in which cases?
vector<char> gives you a guarantee that &v[0]+n == &v[n] whereas a string doesn't (practically, it is the case, but there is no guarantee)... AFAIK C++0x gives that guarantee alreadyconst char* to vector<char>
pop_back() or back() functionsc_str()
Bottom line: Use string when you need to operate with strings. Use vector<char> when you need a ... well, vector of individual chars...
Another use of vector<char> is a way to avoid vector<bool> specialization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With