Make QSpan::isEmpty() constexpr

Negligent omission, since empty() is constexpr, and so is everything
else in the QSpan API.

Amends 03e78e5d624d9752d76c7448d58c9d9d15a4dc18.

[ChangeLog][QtCore][QSpan] Fixed isEmpty() to be constexpr (empty()
already was).

Change-Id: If1e1e72422d68b0c35c37354067098332e6e4e10
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 0576c2b7266003d8f17e9af896de15cf7184b858)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-11-05 14:55:07 +01:00 committed by Qt Cherry-pick Bot
parent f3f9b2ea8a
commit d480177789

View File

@ -425,7 +425,7 @@ public:
[[nodiscard]] constexpr QSpan<T> subspan(size_type pos, size_type n) const { return subspan(pos).first(n); }
// Qt-compatibility API:
[[nodiscard]] bool isEmpty() const noexcept { return empty(); }
[[nodiscard]] constexpr bool isEmpty() const noexcept { return empty(); }
// nullary first()/last() clash with first<>() and last<>(), so they're not provided for QSpan
[[nodiscard]] constexpr QSpan<T> sliced(size_type pos) const { return subspan(pos); }
[[nodiscard]] constexpr QSpan<T> sliced(size_type pos, size_type n) const { return subspan(pos, n); }