From 872f18bbd66d32862b9c10805ee125c466671df4 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 9 Nov 2020 14:47:19 +0100 Subject: Smaller cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get rid of the createInPlace() method. It was just a wraper around a placement new call. Change-Id: I672cd41896c8531b474531aad656be79a1a63e6b Reviewed-by: Thiago Macieira Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Andrei Golubev --- src/corelib/tools/qarraydataops.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/corelib') 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 Data; - template - void createInPlace(T *where, Args&&... args) { new (where) T(std::forward(args)...); } - public: typedef typename QArrayDataPointer::parameter_type parameter_type; @@ -468,9 +465,6 @@ struct QGenericArrayOps protected: typedef QTypedArrayData Data; - template - void createInPlace(T *where, Args&&... args) { new (where) T(std::forward(args)...); } - public: typedef typename QArrayDataPointer::parameter_type parameter_type; @@ -737,7 +731,7 @@ public: Q_ASSERT(this->freeSpaceAtEnd() >= 1); if (where == this->end()) { - createInPlace(this->end(), std::forward(args)...); + new (this->end()) T(std::forward(args)...); ++this->size; } else { T tmp(std::forward(args)...); @@ -771,7 +765,7 @@ public: Q_ASSERT(this->freeSpaceAtBegin() >= 1); if (where == this->begin()) { - createInPlace(this->begin() - 1, std::forward(args)...); + new (this->begin() - 1) T(std::forward(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)...); + new (where) T(std::forward(args)...); } else { T tmp(std::forward(args)...); typedef typename QArrayExceptionSafetyPrimitives::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)...); + new (where - 1) T(std::forward(args)...); } else { T tmp(std::forward(args)...); typedef typename QArrayExceptionSafetyPrimitives::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; -- cgit v1.2.3