We accepted QSpan as a NIH-type instead of waiting for C++20 and std::span, because we said that there's no impedance mismatch between the two, as they both implicitly convert into each other. But we actually never checked that they do. Fix this omission by adding constructors that treat std::span exactly the same as QSpan itself, and adding the respective static_assert()s to tst_QSpan to check that (within the constraints imposed by the standard on std::span), they actually do convert into each other. The only two problematic cases are that fixed-size std::span constructors are explicit, so span is only constructible, not convertible, from QSpan. Likewise, for an rvalue QSpan to be acceptable to the std::span constructor, QSpan needs to opt-in to enable_borrowed_range (while we're at it, do enable_view, too). We so far have rejected adding these opt-ins for our own container classes because we wanted to avoid the compile-time overhead of including the huge <ranges> header into such central headers as those that define our containers. But std::span itself has to specialize these traits, and its range contructor has to use them, so they must be available from <span>, too, possibly the stdlib puts the definition into a much smaller header. So just assume we can specialize it after including just <span>, provided __cpp_lib_concepts is also defined. Change-Id: I2202869b60c98047256b0fbcb12336f5d8e550ba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7f5b795f757ee62af71d8d47ccad19cbf681e0eb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%