[SG16-Unicode] String views with strong code unit types

Lyberta lyberta at lyberta.net
Tue Jun 4 11:39:00 CEST 2019


> Whether we
> like it or not, char, char8_t, char16_t, and char32_t are the strongest
> string literal types we're ever going to have.

We can always modify the standard so that we get strong types via
compiler magic. I was thinking:

utf8'a' -> std::unicode::utf8_code_unit
utf16'a' -> std::unicode::utf16_code_unit
utf32'a' -> std::unicode::utf32_code_unit
utf8"a" -> std::unicode::utf8_code_unit_sequence_view
utf16"a" -> std::unicode::utf16_code_unit_sequence_view
utf32"a" -> std::unicode::utf32_code_unit_sequence_view

Well, that's future. I want something I can use now.

Also, does the standard require well formed sequences in literals?



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
Url : http://www.open-std.org/pipermail/unicode/attachments/20190604/ac94e9c0/attachment.bin 


More information about the Unicode mailing list