C++ Logo


Advanced search

Subject: Re: [SG16-Unicode] String views with strong code unit types
From: Lyberta (lyberta_at_[hidden])
Date: 2019-06-04 04:39:00

> 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?

SG16 list run by sg16-owner@lists.isocpp.org