On Monday, January 28, 2019 at 4:27:50 PM UTC-5, Mr Flibble >
> In practice, if you know what you are doing, a library writer that aspires
> to having users will have as little OS specific (Windows) code in their
> libraries as possible. I have removed most of the wchar_t from "neolib"
> and only have one instance of wchar_t in "neoGFX" (which is much larger
> than "neolib").
>
I note that CharT is a template parameter in your
basic_json_value, hopefully everything will work as expected if
someone plugs in a wchar_t, because char and wchar_t are probably
the only things that anybody will plug into it.
I believe RapidJson supports templated encoding, jsoncons has a
CharT parameter, but I don't think any of the other libraries do.
nhlomann doesn't, and its absence certainly hasn't hurt it's
popularity. In jsoncons, the assumption is that char is UTF8,
char16_t is UTF16, char32_t is UTF32, and wchar_t is UTF16 if
sizeof(wchar_t) is 2 chars, and UTF32 if sizeof(wchar_t) is 4
chars. Unicode validation is performed based on those
assumptions. In any case, I wouldn't expect anyone to specialize
with anything other than char and wchar_t.
In retrospect, I think that having a CharT template parameter in
jsoncons may have been a mistake, and an approach more similar to
std::filesystem might have been better. It would, after all, be
relatively straightforward to hold text in the variant as UTF8,
and have templated accessor as<String> to return whatever
encoding the user wants as deduced from String::char_type,
performing the conversion from UTF8 on demand. Similarly with
stream operators.
Daniel