From 083ebfa1a5cb16b0b62ae5b5855a602b2f9ba818 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Fri, 22 Nov 2024 16:24:03 +0100 Subject: [PATCH] [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 Pick-to: 6.9 6.8 Change-Id: I54f406e3306ee1da136107323887f0c87f94ff9b Reviewed-by: Marc Mutz Reviewed-by: Edward Welbourne --- src/corelib/doc/src/cpp20-overview.qdoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/corelib/doc/src/cpp20-overview.qdoc b/src/corelib/doc/src/cpp20-overview.qdoc index 55beaf366c9..5e485feaf6a 100644 --- a/src/corelib/doc/src/cpp20-overview.qdoc +++ b/src/corelib/doc/src/cpp20-overview.qdoc @@ -40,4 +40,20 @@ facilities in place of platform-specific backends to access timezone information. This remains experimental in Qt 6.9 as some standard library implementations do not faithfully represent the IANA data for timezones. + + \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. */