I'm buiding an API that allows me to fetch strings in various encodings, including utf8, utf16, utf32 and wchar_t (that may be utf32 or utf16 according to OS).
New C++ standard had introduced new types
char16_t
andchar32_t
that do not have this sizeof ambiguity and should be used in future, so I would like to support them as well, but the question is, would they interfere with normaluint16_t
,uint32_t
,wchar_t
types not allowing overload because they may refer to same type?class some_class { public: void set(std::string); // utf8 string void set(std::wstring); // wchar string utf16 or utf32 according // to sizeof(wchar_t) void set(std::basic_string<uint16_t>) // wchar independent utf16 string void set(std::basic_string<uint32_t>); // wchar independent utf32 string #ifdef HAVE_NEW_UNICODE_CHARRECTERS void set(std::basic_string<char16_t>) // new standard utf16 string void set(std::basic_string<char32_t>); // new standard utf32 string #endif };
So I can just write:
foo.set(U"Some utf32 String"); foo.set(u"Some utf16 string");
What are the typedef of
std::basic_string<char16_t>
andstd::basic_string<char32_t>
as there is today:typedef basic_string<wchar_t> wstring.
I can't find any reference.
Edit: according to headers of gcc-4.4, that introduced these new types:
typedef basic_string<char16_t> u16string; typedef basic_string<char32_t> u32string;
I just want to make sure that this is actual standard requirement and not gcc-ism.