====== Convert between std::string and std::wstring ====== Don't use the convert variable inside the to_wstring function. It will make it perform slower. std::wstring_convert, wchar_t> conv_; std::string wideToStr(const std::wstring& wstr) { return conv_.to_bytes(wstr); } std::wstring strToWide(const std::string& str) { return conv_.from_bytes(str); }