[docs] QAnyStringView: mention automatic U8→L1 reclassification

...for US-ASCII literals.

Amends eaabd0c5450ad849e24878d38dd05d5b23d7eec3.

Task-number: QTBUG-101014
Change-Id: Id0acccb9bf2dfb01bca93f62da634e8dfe299fbc
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c51c4aa2c5593e0fbe2b309f0014a49ae6297606)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-08-12 22:38:48 +02:00 committed by Qt Cherry-pick Bot
parent a886dd9f0c
commit d7807ee3fa

View File

@ -45,6 +45,11 @@
Like elsewhere in Qt, QAnyStringView assumes \c char data is encoded
in UTF-8, unless it is presented as a QLatin1StringView.
Since Qt 6.4, however, UTF-8 string literals that are pure US-ASCII are
automatically stored as Latin-1. This is a compile-time check with no
runtime overhead. The feature requires compiling in C++20, or with a recent
GCC.
QAnyStringViews should be passed by value, not by reference-to-const:
\snippet code/src_corelib_text_qanystringview.cpp 0