void TestHelper<CharT, 4>::test() { static_assert((std::is_same<CharT, wchar_t>::value), ""); { typedef std::codecvt_utf8<CharT> Codecvt; typedef std::wstring_convert<Codecvt> Myconv; Myconv myconv; assert(myconv.converted() == 0); std::string bs = myconv.to_bytes(L"\x40003"); assert(myconv.converted() == 1); bs = myconv.to_bytes(L"\x40003\x65"); assert(myconv.converted() == 2); std::wstring ws = myconv.from_bytes("\xF1\x80\x80\x83"); assert(myconv.converted() == 4); } }
int main() { { typedef std::codecvt_utf8<wchar_t> Codecvt; typedef std::wstring_convert<Codecvt> Myconv; Myconv myconv; assert(myconv.converted() == 0); } { typedef std::codecvt_utf8<wchar_t> Codecvt; typedef std::wstring_convert<Codecvt> Myconv; Myconv myconv(new Codecvt); assert(myconv.converted() == 0); } }