C++ Logo

SG16

Advanced search

Subject: [SG16-Unicode] Do we really need basic_text_view?
From: Lyberta (lyberta_at_[hidden])
Date: 2018-08-03 17:55:00


So I'm reading p0224r2 again and found this line:

using text_view = basic_text_view<execution_character_encoding,
                                  /* implementation-defined */ >;

Is it really needed? C++17 added class template argument deduction and
we can use deduction guides to properly instantiate what is now a
basic_text_view. There are make_text_view helpers but I think they are
not needed for most use cases. Consider:

std::text_view tv{u8"Hello"};

This should be what people write in their code, that would deduce UTF-8
view assuming char8_t is in the standard and we use C++17 CTAD.

More importantly, text_view having execution_character_encoding makes
this encoding have more weight to it, especially for beginners. We all
know that in practice working with execution character set is basically
a nightmare, we shouldn't put in on a forefront of text processing.


SG16 list run by herb.sutter at gmail.com