summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstring.cpp
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2021-04-22 16:59:27 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-27 07:39:47 +0000
commitad496ea3b5ae79172af3a0231a65ae7c7ee44492 (patch)
treedd6de76cf8d5e9269098a746358c73bb07ec9058 /src/corelib/text/qstring.cpp
parente5b25862ff00c390a7df19f8b0068dc1e0bb1f57 (diff)
Add q_points_into_range to container utilities
We already used it in QString and QBA. And implicitly in QADP (see parent commit). Might as well move to a common location and reuse Change-Id: I694f0f1dbd109f17c134f64b3f3dc28d19556c88 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 10b46e7f0faecc42a94cc2e25ad3edd08ae28083) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r--src/corelib/text/qstring.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 46d836e9ba..c2af431c94 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -100,12 +100,6 @@
QT_BEGIN_NAMESPACE
-template <typename T, typename Cmp = std::less<>>
-static constexpr bool points_into_range(const T *p, const T *b, const T *e, Cmp less = {}) noexcept
-{
- return !less(p, b) && less(p, e);
-}
-
const char16_t QString::_empty = 0;
/*
@@ -2814,7 +2808,7 @@ QString& QString::insert(qsizetype i, const QChar *unicode, qsizetype size)
return *this;
}
- if (!d->needsDetach() && points_into_range(s, d.data(), d.data() + d.size))
+ if (!d->needsDetach() && QtPrivate::q_points_into_range(s, d.data(), d.data() + d.size))
return insert(i, QStringView{QVarLengthArray(s, s + size)});
d->insert(i, s, size);
@@ -3108,7 +3102,7 @@ static void removeStringImpl(QString &s, const T &needle, Qt::CaseSensitivity cs
QString &QString::remove(const QString &str, Qt::CaseSensitivity cs)
{
const auto s = str.d.data();
- if (points_into_range(s, d.data(), d.data() + d.size))
+ if (QtPrivate::q_points_into_range(s, d.data(), d.data() + d.size))
removeStringImpl(*this, QStringView{QVarLengthArray(s, s + str.size())}, cs);
else
removeStringImpl(*this, qToStringViewIgnoringNull(str), cs);