[docs] Add QSpan details to overview of C++20 features

Document that QSpan exists because we cannot use std::span, and
explicitly point to the differences between QSpan and std::span.

Task-number: QTBUG-128837
Change-Id: I54f406e3306ee1da136107323887f0c87f94ff9b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 083ebfa1a5cb16b0b62ae5b5855a602b2f9ba818)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8bd0625f54bf7cbd2121bbdbcb45fd5f9566b63f)
This commit is contained in:
Ivan Solovev 2024-11-22 16:24:03 +01:00
parent 029af22ef5
commit b4233422e2

View File

@ -31,4 +31,20 @@
{https://en.cppreference.com/w/cpp/chrono/duration} {duration
types}. QTimeZone now supports construction from a \l
{https://en.cppreference.com/w/cpp/chrono/time_zone} {time_zone}.
\section1 QSpan - a Qt version of \c {std::span}
The \l {https://en.cppreference.com/w/cpp/container/span}{std::span} class
template is an addition to the standard library that provides a uniform
way to access a contiguous portion of any contiguous container.
Using \c {std::span} in the public APIs of Qt could provide significant
advantages. However, Qt 6 only requires C++17, meaning it cannot have C++20
types in the API and ABI.
Qt 6.7 introduced \l QSpan - a Qt version of \c {std::span}. The API of the
class is compatible with the std version. \l QSpan and \c {std::span} can be
implicitly converted into each other. However, there are some differences
between the classes. See the corresponding section in the
\l {span-STL} {QSpan class documentation} for more details.
*/