diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index b61686ddde..ee0426d8e8 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -1420,7 +1420,7 @@ QByteArray &QByteArray::operator=(const char *str) \sa isEmpty(), resize() */ -/*! \fn qsizetype QByteArray::max_size() +/*! \fn qsizetype QByteArray::max_size() const \fn qsizetype QByteArray::maxSize() \since 6.8 diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index b090770255..5c9855d32c 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -482,8 +482,7 @@ public: void shrink_to_fit() { squeeze(); } iterator erase(const_iterator first, const_iterator last); inline iterator erase(const_iterator it) { return erase(it, it + 1); } - - static constexpr qsizetype max_size() noexcept + constexpr qsizetype max_size() const noexcept { return maxSize(); } diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 23d9291c0d..c44cc90c7b 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -6414,7 +6414,7 @@ QString& QString::fill(QChar ch, qsizetype size) */ /*! - \fn qsizetype QString::max_size() + \fn qsizetype QString::max_size() const \fn qsizetype QString::maxSize() \since 6.8 diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index c2b62a7069..44a9f888b5 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -969,7 +969,7 @@ public: void shrink_to_fit() { squeeze(); } iterator erase(const_iterator first, const_iterator last); inline iterator erase(const_iterator it) { return erase(it, it + 1); } - static constexpr qsizetype max_size() noexcept + constexpr qsizetype max_size() const noexcept { return maxSize(); } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 62779cba06..6f98ef4d5b 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -691,7 +691,7 @@ public: inline reference back() { return last(); } inline const_reference back() const noexcept { return last(); } void shrink_to_fit() { squeeze(); } - static constexpr qsizetype max_size() noexcept + constexpr qsizetype max_size() const noexcept { return maxSize(); } diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc index 74da71896b..19b10fde4d 100644 --- a/src/corelib/tools/qlist.qdoc +++ b/src/corelib/tools/qlist.qdoc @@ -1332,7 +1332,7 @@ returns \c false. */ -/*! \fn template qsizetype QList::max_size() +/*! \fn template qsizetype QList::max_size() const \fn template qsizetype QList::maxSize() \since 6.8 diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 577a5b193e..66c8e0bd13 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -189,7 +189,7 @@ public: // -1 to deal with the pointer one-past-the-end return (QtPrivate::MaxAllocSize / sizeof(T)) - 1; } - static constexpr qsizetype max_size() noexcept + constexpr qsizetype max_size() const noexcept { return maxSize(); } @@ -409,9 +409,10 @@ public: #ifdef Q_QDOC inline qsizetype size() const { return this->s; } static constexpr qsizetype maxSize() noexcept { return QVLABase::maxSize(); } - static constexpr qsizetype max_size() noexcept { return QVLABase::max_size(); } + constexpr qsizetype max_size() const noexcept { return QVLABase::max_size(); } #endif using Base::size; + using Base::max_size; inline qsizetype count() const { return size(); } inline qsizetype length() const { return size(); } inline T &first() diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 8305f49536..b17aedc533 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -140,7 +140,7 @@ \sa isEmpty(), resize() */ -/*! \fn template qsizetype QVarLengthArray::max_size() +/*! \fn template qsizetype QVarLengthArray::max_size() const \fn template qsizetype QVarLengthArray::maxSize() \since 6.8