Why mask a char with 0xFF when converting narrow string to wide string?
问题 Consider this function to convert narrow strings to wide strings: std::wstring convert(const std::string& input) { try { std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter; return converter.from_bytes(input); } catch(std::range_error& e) { std::size_t length = input.length(); std::wstring result; result.reserve(length); for(std::size_t i = 0; i < length; i++) { result.push_back(input[i] & 0xFF); } return result; } } I am having difficulty understanding the need for this