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>
bb10
Marc Mutz 2024-04-16 13:30:45 +02:00
parent 7466831509
commit 7cf57cffbc
1 changed files with 2 additions and 2 deletions

View File

@ -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