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.

Pick-to: 6.6
Change-Id: Ic8ae3a1c03801b4a23b7ba56388372cac64f9e5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-12-06 16:36:46 +01:00
parent c851fb2456
commit d6969b76a5

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;