diff options
Diffstat (limited to 'src/corelib/text/qanystringview.qdoc')
-rw-r--r-- | src/corelib/text/qanystringview.qdoc | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/corelib/text/qanystringview.qdoc b/src/corelib/text/qanystringview.qdoc index b3e8baa3f9..31b29fd7a7 100644 --- a/src/corelib/text/qanystringview.qdoc +++ b/src/corelib/text/qanystringview.qdoc @@ -197,11 +197,9 @@ \fn template <typename Char, size_t N> QAnyStringView::QAnyStringView(const Char (&string)[N]) Constructs a string view on the character string literal \a string. - The length is set to \c{N-1}, excluding the trailing \c{Char(0)}. - If you need the full array, use the constructor from pointer and - size instead: - - \snippet code/src_corelib_text_qanystringview.cpp 2 + The view covers the array until the first \c{Char(0)} is encountered, + or \c N, whichever comes first. + If you need the full array, use fromArray() instead. \a string must remain valid for the lifetime of this string view object. @@ -251,6 +249,27 @@ */ /*! + \fn template <typename Char, size_t Size> static QAnyStringView fromArray(const Char (&string)[Size]) noexcept + + Constructs a string view on the full character string literal \a string, + including any trailing \c{Char(0)}. If you don't want the + null-terminator included in the view then you can use the constructor + overload taking a pointer and a size: + + \snippet code/src_corelib_text_qanystringview.cpp 2 + + Alternatively you can use the constructor overload taking an + array literal which will create a view up to, but not including, + the first null-terminator in the data. + + \a string must remain valid for the lifetime of this string view + object. + + This function will work with any array literal if \c Char is a + compatible character type. +*/ + +/*! \fn QString QAnyStringView::toString() const Returns a deep copy of this string view's data as a QString. |