summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-11-09 14:47:19 +0100
committerLars Knoll <lars.knoll@qt.io>2020-11-17 11:46:22 +0100
commit872f18bbd66d32862b9c10805ee125c466671df4 (patch)
tree8f97910e7210de4bc162cd3bda5db97fd8e35fc9
parent21116d60176cecf5e467f5edb44958a76a49197d (diff)
Smaller cleanup
Get rid of the createInPlace() method. It was just a wraper around a placement new call. Change-Id: I672cd41896c8531b474531aad656be79a1a63e6b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
-rw-r--r--src/corelib/tools/qarraydataops.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h
index fbac26fc30..183b6b0410 100644
--- a/src/corelib/tools/qarraydataops.h
+++ b/src/corelib/tools/qarraydataops.h
@@ -226,9 +226,6 @@ struct QPodArrayOps
protected:
typedef QTypedArrayData<T> Data;
- template <typename ...Args>
- void createInPlace(T *where, Args&&... args) { new (where) T(std::forward<Args>(args)...); }
-
public:
typedef typename QArrayDataPointer<T>::parameter_type parameter_type;
@@ -468,9 +465,6 @@ struct QGenericArrayOps
protected:
typedef QTypedArrayData<T> Data;
- template <typename ...Args>
- void createInPlace(T *where, Args&&... args) { new (where) T(std::forward<Args>(args)...); }
-
public:
typedef typename QArrayDataPointer<T>::parameter_type parameter_type;
@@ -737,7 +731,7 @@ public:
Q_ASSERT(this->freeSpaceAtEnd() >= 1);
if (where == this->end()) {
- createInPlace(this->end(), std::forward<Args>(args)...);
+ new (this->end()) T(std::forward<Args>(args)...);
++this->size;
} else {
T tmp(std::forward<Args>(args)...);
@@ -771,7 +765,7 @@ public:
Q_ASSERT(this->freeSpaceAtBegin() >= 1);
if (where == this->begin()) {
- createInPlace(this->begin() - 1, std::forward<Args>(args)...);
+ new (this->begin() - 1) T(std::forward<Args>(args)...);
--this->ptr;
++this->size;
} else {
@@ -1006,12 +1000,12 @@ public:
Q_ASSERT(this->freeSpaceAtEnd() >= 1);
if (where == this->end()) {
- this->createInPlace(where, std::forward<Args>(args)...);
+ new (where) T(std::forward<Args>(args)...);
} else {
T tmp(std::forward<Args>(args)...);
typedef typename QArrayExceptionSafetyPrimitives<T>::Displacer ReversibleDisplace;
ReversibleDisplace displace(where, this->end(), 1);
- this->createInPlace(where, std::move(tmp));
+ new (where) T(std::move(tmp));
displace.commit();
}
++this->size;
@@ -1025,12 +1019,12 @@ public:
Q_ASSERT(this->freeSpaceAtBegin() >= 1);
if (where == this->begin()) {
- this->createInPlace(where - 1, std::forward<Args>(args)...);
+ new (where - 1) T(std::forward<Args>(args)...);
} else {
T tmp(std::forward<Args>(args)...);
typedef typename QArrayExceptionSafetyPrimitives<T>::Displacer ReversibleDisplace;
ReversibleDisplace displace(this->begin(), where, -1);
- this->createInPlace(where - 1, std::move(tmp));
+ new (where - 1) T(std::move(tmp));
displace.commit();
}
--this->ptr;