From 3f6142f5a1a01f201593f6711930ec77640dea46 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 10 Jun 2020 15:00:48 +0200 Subject: Rename new slice() method sliced() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Lars Knoll --- src/corelib/text/qstringview.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/text/qstringview.h') 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); } -- cgit v1.2.3