QSpan: apply LWG 3346 work-around

We have not hit the GCC < 10.4 problem with containers that define
both element_type and value_type, yet, but we have with
QVersionNumber, so proactively apply it to QSpan, too.

While we're at it, copy the QList code to mark QSpan, too, as
contiguous.

Pick-to: 6.6
Change-Id: I883fd0b5f75db175a730262035ebbf0cb19de529
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 95feea933bbc67ab4a188470973da3f4df450c3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-02-08 11:38:33 +01:00 committed by Qt Cherry-pick Bot
parent bfd565a4d3
commit c4de095be1

View File

@ -316,14 +316,17 @@ class QSpan
static constexpr bool subspan_always_succeeds_v = N <= E && E != q20::dynamic_extent;
public:
// constants and types
using value_type = std::remove_cv_t<T>;
#ifdef QT_COMPILER_HAS_LWG3346
using iterator_concept = std::contiguous_iterator_tag;
using element_type = T;
using value_type = std::remove_cv_t<element_type>;
#endif
using size_type = qsizetype; // difference to std::span
using difference_type = qptrdiff; // difference to std::span
using pointer = element_type*;
using const_pointer = const element_type*;
using reference = element_type&;
using const_reference = const element_type&;
using pointer = T*;
using const_pointer = const T*;
using reference = T&;
using const_reference = const T&;
using iterator = pointer; // implementation-defined choice
using const_iterator = const_pointer; // implementation-defined choice
using reverse_iterator = std::reverse_iterator<iterator>;