mirror of https://github.com/qt/qtbase.git
Q*StringView::contains: call the char overload of indexOf()
Avoids an unnecessary QStringView and possibly pessimizing the code generation. Pick-to: 6.10 6.9 6.8 Change-Id: Iac1ff680887641888e00fffd17e098972382bf10 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
parent
48c3c81df0
commit
e00ca26f9a
|
@ -131,7 +131,7 @@ public:
|
|||
[[nodiscard]] bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
|
||||
{ return indexOf(s, 0, cs) != -1; }
|
||||
[[nodiscard]] bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
|
||||
{ return indexOf(QStringView(&c, 1), 0, cs) != -1; }
|
||||
{ return indexOf(c, 0, cs) != -1; }
|
||||
|
||||
[[nodiscard]] qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
|
||||
{ return lastIndexOf(s, size(), cs); }
|
||||
|
|
|
@ -284,7 +284,7 @@ public:
|
|||
[[nodiscard]] inline qsizetype indexOf(QLatin1StringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
|
||||
|
||||
[[nodiscard]] bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
|
||||
{ return indexOf(QStringView(&c, 1), 0, cs) != qsizetype(-1); }
|
||||
{ return indexOf(c, 0, cs) != qsizetype(-1); }
|
||||
[[nodiscard]] bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
|
||||
{ return indexOf(s, 0, cs) != qsizetype(-1); }
|
||||
[[nodiscard]] inline bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
|
||||
|
|
Loading…
Reference in New Issue