From the following
Can I turn unsigned char into char and vice versa?
it appears that converting a basic_string<unsigned char> to a basic_string<char> (i.e. std::string) is a valid operation. But I can't figure out how to do it.
For example what functions could perform the following conversions, filling in the functionality of these hypothetical stou and utos functions?
typedef basic_string<unsigned char> u_string; int main() { string s = "dog"; u_string u = stou(s); string t = utos(u); } I've tried to use reinterpret_cast, static_cast, and a few others but my knowledge of their intended functionality is limited.
[A-Za-z0-9]characters through the conversions fromstotin the code above.ustring u(s.begin(), s.end());