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).

Pick-to: 6.8
Change-Id: If1e1e72422d68b0c35c37354067098332e6e4e10
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Marc Mutz 2024-11-05 14:55:07 +01:00
parent 2cf12a6bae
commit 0576c2b726

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); }