Make Container::max_size() non-static member functions
... as is required by the standard.
We have already found that QAnyStringView::max_size() can also not be
static (because the size depends on the charset of the contained
data), so we have a second reason (besides STL compatibility) to
change the current static into non-static max_size() member functions:
Qt consistency.
Found in API-Review.
Amends 7ce6920aac.
Fixes: QTBUG-128450
Change-Id: Id5ee3fec82bc557bd83b6843838ccdd753442cd0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6d5e39f4756945b8ada74d745bd949856c1b17f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
bb10
parent
bcd33276d1
commit
0396def8ad
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1332,7 +1332,7 @@
|
|||
returns \c false.
|
||||
*/
|
||||
|
||||
/*! \fn template <typename T> qsizetype QList<T>::max_size()
|
||||
/*! \fn template <typename T> qsizetype QList<T>::max_size() const
|
||||
\fn template <typename T> qsizetype QList<T>::maxSize()
|
||||
\since 6.8
|
||||
|
||||
|
|
|
|||
|
|
@ -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<T>::maxSize(); }
|
||||
static constexpr qsizetype max_size() noexcept { return QVLABase<T>::max_size(); }
|
||||
constexpr qsizetype max_size() const noexcept { return QVLABase<T>::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()
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
\sa isEmpty(), resize()
|
||||
*/
|
||||
|
||||
/*! \fn template<class T, qsizetype Prealloc> qsizetype QVarLengthArray<T, Prealloc>::max_size()
|
||||
/*! \fn template<class T, qsizetype Prealloc> qsizetype QVarLengthArray<T, Prealloc>::max_size() const
|
||||
\fn template<class T, qsizetype Prealloc> qsizetype QVarLengthArray<T, Prealloc>::maxSize()
|
||||
\since 6.8
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue