The most common way is std::ctype<wchar_t>::narrow() , but it does a little more than std :: copy as suggested by gishu, and you still need to manage your buffers.
If you are not trying to make any translation, but want only one-line, you can do std::string my_string( my_wstring.begin(), my_wstring.end() ) .
If you need the actual code translation, you can use locales / codecvt or one of the libraries from the other answer, but I assume that is not what you are looking for.
source share