diff --git a/src/corelib/text/qstringview.cpp b/src/corelib/text/qstringview.cpp index b64d128a65c..1c3249fbfb4 100644 --- a/src/corelib/text/qstringview.cpp +++ b/src/corelib/text/qstringview.cpp @@ -395,7 +395,7 @@ QT_BEGIN_NAMESPACE This function is provided for STL compatibility. - \sa end(), cbegin(), rbegin(), data() + \sa end(), constBegin(), cbegin(), rbegin(), data() */ /*! @@ -405,7 +405,16 @@ QT_BEGIN_NAMESPACE This function is provided for STL compatibility. - \sa cend(), begin(), crbegin(), data() + \sa cend(), begin(), constBegin(), crbegin(), data() +*/ + +/*! + \fn QStringView::const_iterator QStringView::constBegin() const + \since 6.1 + + Same as begin(). + + \sa constEnd(), begin(), cbegin(), crbegin(), data() */ /*! @@ -416,7 +425,7 @@ QT_BEGIN_NAMESPACE This function is provided for STL compatibility. - \sa begin(), cend(), rend() + \sa begin(), constEnd(), cend(), rend() */ /*! \fn QStringView::const_iterator QStringView::cend() const @@ -425,7 +434,15 @@ QT_BEGIN_NAMESPACE This function is provided for STL compatibility. - \sa cbegin(), end(), crend() + \sa cbegin(), end(), constEnd(), crend() +*/ + +/*! \fn QStringView::const_iterator QStringView::constEnd() const + \since 6.1 + + Same as end(). + + \sa constBegin(), end(), cend(), crend() */ /*! diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h index 42935440f33..fef2ffde7b3 100644 --- a/src/corelib/text/qstringview.h +++ b/src/corelib/text/qstringview.h @@ -442,6 +442,8 @@ public: // // Qt compatibility API: // + [[nodiscard]] const_iterator constBegin() const noexcept { return begin(); } + [[nodiscard]] const_iterator constEnd() const noexcept { return end(); } [[nodiscard]] constexpr bool isNull() const noexcept { return !m_data; } [[nodiscard]] constexpr bool isEmpty() const noexcept { return empty(); } [[nodiscard]] constexpr int length() const /* not nothrow! */