C++ Logo

sg16

Advanced search

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

From: Lyberta <lyberta_at_[hidden]>
Date: Tue, 04 Jun 2019 09:39:00 +0000
> 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?




Received on 2019-06-04 11:39:44