summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstringview.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-05-15 15:18:10 +0200
committerLars Knoll <lars.knoll@qt.io>2020-05-30 23:11:20 +0200
commit6a6314df1e7ae7b392d13f1dcf3d595d9e689658 (patch)
tree953c6f8a41017a5c4d2c5a2158c8c5ebd10e8894 /src/corelib/text/qstringview.h
parenta1056096fc5ec316a650fd8ae1c2a22b6944d091 (diff)
Add QStringView::constData()
This is doing the same as data(), but the method is widely being used in Qt (e.g. in QString), so this will make it easier to change the type of a variable from QString(Ref) to QStringView in a source compatible way. Change-Id: Ic49bef688d3ce3c550336edf90130aa5cac8b497 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstringview.h')
-rw-r--r--src/corelib/text/qstringview.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index e2e1abb62d..5890515652 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -236,6 +236,7 @@ public:
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qsizetype size() const noexcept { return m_size; }
Q_REQUIRED_RESULT const_pointer data() const noexcept { return reinterpret_cast<const_pointer>(m_data); }
+ Q_REQUIRED_RESULT const_pointer constData() const noexcept { return data(); }
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR const storage_type *utf16() const noexcept { return m_data; }
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qsizetype n) const