I am using a library which accepts data as a vector
of char
s. I need to pass a string
to the library.
I think about using std::vector
constructor which accepts iterators to carry out the conversion - but wondered if there is a better way of doing it?
/*Note: json_str is of type std::string*/
const std::vector<char> charvect(json_str.begin(), json_str.end());
See Question&Answers more detail:os