C++ Logo

SG16

Advanced search

Subject: Re: [SG16-Unicode] code_unit_sequence and code_point_sequence
From: Tom Honermann (tom_at_[hidden])
Date: 2018-08-03 00:38:00


On 08/03/2018 01:18 AM, Lyberta wrote:
> OK. I withdraw code_unit_sequence proposal but I think
> code_point_sequence is still very relevant. Consider this:
>
> std::code_point_sequence cps{u8"Test"};
> for (const auto cp : cps)
> {
> std::cout << std::code_point_name(cp) << '\n';
> }
>
> Output:
>
> LATIN CAPITAL LETTER T
> LATIN SMALL LETTER E
> LATIN SMALL LETTER S
> LATIN SMALL LETTER T
>
> This fragment will be used pretty much everywhere when teaching C++ and
> Unicode.

Text_view supports (C++17) range-based-for as you used it above today. 
See https://github.com/tahonermann/text_view#overview. Support for code
point properties is still missing though.  I think a key difference is
that you intend code_point_sequence to be a container (not a view).  If
so, I still prefer a more abstract std::text type that supports code
point (and code unit and EGC) enumeration.

Tom.


SG16 list run by herb.sutter at gmail.com