diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-12-07 20:10:50 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-12-13 21:54:01 +0100 |
commit | 95c7f88132646489bc17b8ea32facd76a19e19fa (patch) | |
tree | 0536fefc4b564a58bc68d53dc038e8349ab65c40 /src/corelib/tools/qarraydata.h | |
parent | cbb4aea2132fc59cd1086ba42cc221d12b5ce9e8 (diff) |
QArrayData/Pointer: s/QPair/std::pair/
Also port from qMakePair to just braced initialization and CTAD.
Task-number: QTBUG-115841
Pick-to: 6.7
Change-Id: Ifd7220ae88b101351e91d1488ce18715eb4880e5
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r-- | src/corelib/tools/qarraydata.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index ef485a7fbd..2900b0178e 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -95,7 +95,7 @@ struct QArrayData static Q_CORE_EXPORT void *allocate2(QArrayData **pdata, qsizetype capacity, AllocationOption option = QArrayData::KeepSize) noexcept; - [[nodiscard]] static Q_CORE_EXPORT QPair<QArrayData *, void *> reallocateUnaligned(QArrayData *data, void *dataPointer, + [[nodiscard]] static Q_CORE_EXPORT std::pair<QArrayData *, void *> reallocateUnaligned(QArrayData *data, void *dataPointer, qsizetype objectSize, qsizetype newCapacity, AllocationOption option) noexcept; static Q_CORE_EXPORT void deallocate(QArrayData *data, qsizetype objectSize, qsizetype alignment) noexcept; @@ -125,7 +125,7 @@ struct QTypedArrayData { struct AlignmentDummy { QtPrivate::AlignedQArrayData header; T data; }; - [[nodiscard]] static QPair<QTypedArrayData *, T *> allocate(qsizetype capacity, AllocationOption option = QArrayData::KeepSize) + [[nodiscard]] static std::pair<QTypedArrayData *, T *> allocate(qsizetype capacity, AllocationOption option = QArrayData::KeepSize) { static_assert(sizeof(QTypedArrayData) == sizeof(QArrayData)); QArrayData *d; @@ -143,16 +143,16 @@ struct QTypedArrayData // and yet we do offer results that have stricter alignment result = __builtin_assume_aligned(result, Q_ALIGNOF(AlignmentDummy)); #endif - return qMakePair(static_cast<QTypedArrayData *>(d), static_cast<T *>(result)); + return {static_cast<QTypedArrayData *>(d), static_cast<T *>(result)}; } - static QPair<QTypedArrayData *, T *> + static std::pair<QTypedArrayData *, T *> reallocateUnaligned(QTypedArrayData *data, T *dataPointer, qsizetype capacity, AllocationOption option) { static_assert(sizeof(QTypedArrayData) == sizeof(QArrayData)); - QPair<QArrayData *, void *> pair = + std::pair<QArrayData *, void *> pair = QArrayData::reallocateUnaligned(data, dataPointer, sizeof(T), capacity, option); - return qMakePair(static_cast<QTypedArrayData *>(pair.first), static_cast<T *>(pair.second)); + return {static_cast<QTypedArrayData *>(pair.first), static_cast<T *>(pair.second)}; } static void deallocate(QArrayData *data) noexcept |