<div dir="auto">`codepoint` also, which is probably "just" a char32_t? </div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 5, 2018, 01:40 Tom Honermann <<a href="mailto:tom@honermann.net">tom@honermann.net</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 12/4/18 11:17 PM, Lyberta wrote:<br>
> This is something that hit me recently. Why are we using fundamental<br>
> types for code units? CppCon 2018 is full of people saying that we<br>
> should migrate to strong types, that std::size_t should have been a<br>
> struct, etc.<br>
The primary reason for using fundamental types for code units is that <br>
those are the types used for character and string literals.<br>
><br>
> I propose we add strong types for code units:<br>
><br>
> * utf8_code_unit<br>
> * utf16_code_unit<br>
> * utf32_code_unit<br>
><br>
> These will hold char8,16,32_t inside of them respectively but will not<br>
> allow the invalid values such as >245 for UTF-8, surrogates and<br>
>> 0x10FFFF for UTF-32, etc.<br>
> This will guarantee that all code units are valid and will allow us to<br>
> write much faster code because we will never need to check for invalid<br>
> values.<br>
<br>
The downside of such validating types is the validation overhead.<br>
<br>
I am in favor of introducing strong types for code points.<br>
<br>
Tom.<br>
<br>
_______________________________________________<br>
SG16 Unicode mailing list<br>
<a href="mailto:Unicode@isocpp.open-std.org" target="_blank" rel="noreferrer">Unicode@isocpp.open-std.org</a><br>
<a href="http://www.open-std.org/mailman/listinfo/unicode" rel="noreferrer noreferrer" target="_blank">http://www.open-std.org/mailman/listinfo/unicode</a><br>
</blockquote></div>