summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstringview.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2020-06-10 15:00:48 +0200
committerMarc Mutz <marc.mutz@kdab.com>2020-06-11 19:14:03 +0000
commit3f6142f5a1a01f201593f6711930ec77640dea46 (patch)
tree3f6ee88ae701993087454f1193902eb976d1167d /src/corelib/text/qstringview.h
parent7b15417b53ce8c278ab3fcc8c32f8203da4ed697 (diff)
Rename new slice() method sliced()
The recently-added slice() method has the problem that it's a noun as well as a verb in the imperative. Like std::vector::empty, which is both an adjective and a verb in the imperative, this may cause confusion as to what the function does. Using the passive voice form of slice(), sliced(), removes the confusion. While it can be read as an adjective, too, that doesn't change the meaning compared to the verb form. Change-Id: If0aa01acb6cf5dd5eafa8226e3ea7f7a0c9da4f1 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/text/qstringview.h')
-rw-r--r--src/corelib/text/qstringview.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index 6dbec21165..67c4825413 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -282,7 +282,7 @@ public:
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data + size() - n, int(n)); }
Q_REQUIRED_RESULT constexpr QStringView from(qsizetype pos) const
{ Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QStringView(m_data + pos, size() - int(pos)); }
- Q_REQUIRED_RESULT constexpr QStringView slice(qsizetype pos, qsizetype n) const
+ Q_REQUIRED_RESULT constexpr QStringView sliced(qsizetype pos, qsizetype n) const
{ Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QStringView(m_data + pos, int(n)); }
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, m_size - n); }