From d480177789079328f7d30eed0fce76c9543cc46c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 5 Nov 2024 14:55:07 +0100 Subject: [PATCH] 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 (cherry picked from commit 0576c2b7266003d8f17e9af896de15cf7184b858) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qspan.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qspan.h b/src/corelib/tools/qspan.h index 65362f94b24..f6ec8280fbc 100644 --- a/src/corelib/tools/qspan.h +++ b/src/corelib/tools/qspan.h @@ -425,7 +425,7 @@ public: [[nodiscard]] constexpr QSpan 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 sliced(size_type pos) const { return subspan(pos); } [[nodiscard]] constexpr QSpan sliced(size_type pos, size_type n) const { return subspan(pos, n); }