From 7cf57cffbc910918bddefc02c6171945c1149364 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 16 Apr 2024 13:30:45 +0200 Subject: [PATCH] QByteArrayView: make starts/endsWith(char) constexpr Their implementations call only constexpr functions, so they should be constexpr, too. [ChangeLog][QtCore][QByteArrayView] The startsWith(char) and endsWith(char) functions are now constexpr. Change-Id: I41f57ce3428a8de441e3c230aafc7bf426651c9f Reviewed-by: Ivan Solovev --- src/corelib/text/qbytearrayview.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/text/qbytearrayview.h b/src/corelib/text/qbytearrayview.h index 90454f1c93..45ebc812cd 100644 --- a/src/corelib/text/qbytearrayview.h +++ b/src/corelib/text/qbytearrayview.h @@ -256,12 +256,12 @@ public: [[nodiscard]] bool startsWith(QByteArrayView other) const noexcept { return QtPrivate::startsWith(*this, other); } - [[nodiscard]] bool startsWith(char c) const noexcept + [[nodiscard]] constexpr bool startsWith(char c) const noexcept { return !empty() && front() == c; } [[nodiscard]] bool endsWith(QByteArrayView other) const noexcept { return QtPrivate::endsWith(*this, other); } - [[nodiscard]] bool endsWith(char c) const noexcept + [[nodiscard]] constexpr bool endsWith(char c) const noexcept { return !empty() && back() == c; } [[nodiscard]] qsizetype indexOf(QByteArrayView a, qsizetype from = 0) const noexcept