[SG16-Unicode] code_unit_sequence and code_point_sequence

Tom Honermann tom at honermann.net
Fri Aug 3 07:38:00 CEST 2018


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.


More information about the Unicode mailing list