summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-08-22 15:40:42 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-10-25 12:01:58 -0700
commit2fd0996324304c4c055059a980b6f9b32b843574 (patch)
treedd89257e84270e3d080694c7821892d2522f4f3a /tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
parent793cfec9418c6a900883c65e947993f320f5c987 (diff)
QArrayDataPointer: add an allocating constructor
It's by far the most common use, so having to call two things is just cumbersome. Change-Id: I79e700614d034281bf55fffd178f454c4e31929e Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp')
-rw-r--r--tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
index 20f1a3ab13..92a3d91e8c 100644
--- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
+++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
@@ -1116,8 +1116,7 @@ void tst_QArrayData::arrayOpsExtra()
const auto cloneArrayDataPointer = [] (auto &dataPointer, size_t capacity) {
using ArrayPointer = std::decay_t<decltype(dataPointer)>;
- using Type = std::decay_t<typename ArrayPointer::parameter_type>;
- ArrayPointer copy(QTypedArrayData<Type>::allocate(qsizetype(capacity)));
+ ArrayPointer copy{qsizetype(capacity)};
copy->copyAppend(dataPointer.begin(), dataPointer.end());
return copy;
};
@@ -2037,7 +2036,7 @@ void tst_QArrayData::dataPointerAllocate()
const auto createDataPointer = [] (qsizetype capacity, auto initValue) {
using Type = std::decay_t<decltype(initValue)>;
Q_UNUSED(initValue);
- return QArrayDataPointer<Type>(QTypedArrayData<Type>::allocate(capacity));
+ return QArrayDataPointer<Type>(capacity);
};
const auto testRealloc = [&] (qsizetype capacity, qsizetype newSize, auto initValue) {
@@ -2453,7 +2452,7 @@ void tst_QArrayData::relocateWithExceptions()
};
const auto createDataPointer = [](qsizetype capacity, qsizetype initSize) {
- QArrayDataPointer<ThrowingType> qadp(QTypedArrayData<ThrowingType>::allocate(capacity));
+ QArrayDataPointer<ThrowingType> qadp(capacity);
qadp->appendInitialize(initSize);
int i = 0;
std::generate(qadp.begin(), qadp.end(), [&i]() { return ThrowingType(i++); });