How to convert std::string to std::vector<uint8_t>?
std::vector
has a constructor just for this purpose:
std::string str;
std::vector<uint8_t> vec(str.begin(), str.end());
Adding to DeiDei's answer, you can do the following if the vector is already constructed:
std::string str;
std::vector<uint8_t> vec;
vec.assign(str.begin(), str.end());