QSpan: don't truncate QSpan::extent

My notes inform me that my intent was for QSpan::extent to be size_t,
for compatibility with both its template argument and
std::span::extent.

So fix it to be size_t instead of qsizetype. While extents that go
beyond numeric_limits<qsizetype>::max() will be unusable in practice,
QSpan doesn't actually allocate memory, so declaring one should be
possible, if only for compatibility with std::span, without getting
into a situation where E != extent.

Change-Id: Ic8ae3a1c03801b4a23b7ba56388372cac64f9e5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d6969b76a5281d5dcadc6ef722594d6ba2effd68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-12-06 16:36:46 +01:00 committed by Qt Cherry-pick Bot
parent 1945c5f40c
commit 010ce12a82

View File

@ -283,7 +283,7 @@ public:
using const_iterator = const_pointer; // implementation-defined choice
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
static constexpr size_type extent = E;
static constexpr std::size_t extent = E;
// [span.cons], constructors, copy, and assignment
using Base::Base;