diff options
author | Marc Mutz <marc.mutz@qt.io> | 2024-04-16 13:30:45 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2024-04-17 20:07:47 +0200 |
commit | 7cf57cffbc910918bddefc02c6171945c1149364 (patch) | |
tree | 41a7205989135aafd5c2e012b27c8661e6c1d8be /src/corelib/text/qbytearrayview.h | |
parent | 7466831509fe163f3fd1e3a6bbf38f6f5a32ef00 (diff) |
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 <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearrayview.h')
-rw-r--r-- | src/corelib/text/qbytearrayview.h | 4 |
1 files 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 |