<div dir="auto">`codepoint` also, which is probably &quot;just&quot; a char32_t? </div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 5, 2018, 01:40 Tom Honermann &lt;<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>
&gt; This is something that hit me recently. Why are we using fundamental<br>
&gt; types for code units? CppCon 2018 is full of people saying that we<br>
&gt; should migrate to strong types, that std::size_t should have been a<br>
&gt; 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>
&gt;<br>
&gt; I propose we add strong types for code units:<br>
&gt;<br>
&gt; * utf8_code_unit<br>
&gt; * utf16_code_unit<br>
&gt; * utf32_code_unit<br>
&gt;<br>
&gt; These will hold char8,16,32_t inside of them respectively but will not<br>
&gt; allow the invalid values such as &gt;245 for UTF-8, surrogates and<br>
&gt;&gt; 0x10FFFF for UTF-32, etc.<br>
&gt; This will guarantee that all code units are valid and will allow us to<br>
&gt; write much faster code because we will never need to check for invalid<br>
&gt; 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>