use wstring_convert (but is deprecated in c++17)

This commit is contained in:
ToruNiina 2017-05-17 13:08:24 +09:00
parent 5ffc51a99d
commit 1fc58095fa

View File

@ -1074,7 +1074,13 @@ toml::Table parse(std::basic_istream<wchar_t, traits>& is)
std::vector<wchar_t> contents(size);
is.read(contents.data(), size);
is.imbue(curloc);
return parse_data::invoke(contents.cbegin(), contents.cend());
std::wstring wstr(size, ' ');
std::copy(contents.cbegin(), contents.cend(), wstr.begin());
std::wstring_convert<std::convert_utf8<wchar_t>, wchar_t> cvter;
std::string u8str = converter.to_bytes(wstr);
return parse_data::invoke(u8str.cbegin(), u8str.cend());
}
toml::Table parse(const std::string& filename)