QScopedArrayPointer: port to qsizetype

[ChangeLog][QtCore][QScopedArrayPointer] Is no longer limited to 2Gi
elements in size.

Task-number: QTBUG-103533
Change-Id: Ic591b3245c53d478e42ff054e01054d855b38685
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2022-08-20 21:21:10 +02:00
parent 3f32b01b98
commit e1cf523354
2 changed files with 10 additions and 4 deletions

View File

@ -276,24 +276,30 @@ QT_BEGIN_NAMESPACE
*/
/*!
\fn template <typename T, typename Cleanup> T *QScopedArrayPointer<T, Cleanup>::operator[](int i)
\fn template <typename T, typename Cleanup> T *QScopedArrayPointer<T, Cleanup>::operator[](qsizetype i)
Provides access to entry \a i of the scoped pointer's array of
objects.
If the contained pointer is \nullptr, behavior is undefined.
\note In Qt versions prior to 6.5, \a i was of type \c{int}, not
\c{qsizetype}, possibly causing truncation on 64-bit platforms.
\sa isNull()
*/
/*!
\fn template <typename T, typename Cleanup> T *QScopedArrayPointer<T, Cleanup>::operator[](int i) const
\fn template <typename T, typename Cleanup> T *QScopedArrayPointer<T, Cleanup>::operator[](qsizetype i) const
Provides access to entry \a i of the scoped pointer's array of
objects.
If the contained pointer is \nullptr behavior is undefined.
\note In Qt versions prior to 6.5, \a i was of type \c{int}, not
\c{qsizetype}, possibly causing truncation on 64-bit platforms.
\sa isNull()
*/

View File

@ -201,12 +201,12 @@ public:
{
}
inline T &operator[](int i)
T &operator[](qsizetype i)
{
return this->d[i];
}
inline const T &operator[](int i) const
const T &operator[](qsizetype i) const
{
return this->d[i];
}