diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-11-12 12:56:11 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-17 11:47:32 +0100 |
commit | c0e1a38f69cb3bc43649c7a45896b1fcf807279a (patch) | |
tree | d2736a7a7c5599418ba013585da227bdbfc0187e /src/corelib/tools/qarraydataops.h | |
parent | 30597cfc0ef299356a2d200a5628612d4d0b222c (diff) |
Remove the special code for emplaceFront/Back again
emplace() itself now handles those cases fast enough, so there
should not be a need to add special code paths for those methods.
Change-Id: I3277eb77dd54194e46f96f24de44d7785a6f860a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qarraydataops.h')
-rw-r--r-- | src/corelib/tools/qarraydataops.h | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index 6b775fd47c..1efa94ebd1 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -932,41 +932,6 @@ public: ++this->size; } } - -public: - - template <typename ...Args> - void emplaceBack(Args&&... args) - { - if (this->needsDetach() || !this->freeSpaceAtEnd()) { - // protect against args being an element of the container - T tmp(std::forward<Args>(args)...); - this->reallocateAndGrow(QArrayData::GrowsAtEnd, 1); - Q_ASSERT(!this->isShared()); - Q_ASSERT(this->freeSpaceAtEnd() >= 1); - new (this->end()) T(std::move(tmp)); - } else { - new (this->end()) T(std::forward<Args>(args)...); - } - ++this->size; - } - - template <typename ...Args> - void emplaceFront(Args&&... args) - { - if (this->needsDetach() || !this->freeSpaceAtBegin()) { - // protect against args being an element of the container - T tmp(std::forward<Args>(args)...); - this->reallocateAndGrow(QArrayData::GrowsAtBeginning, 1); - Q_ASSERT(!this->isShared()); - Q_ASSERT(this->freeSpaceAtBegin() >= 1); - new (this->ptr - 1) T(std::move(tmp)); - } else { - new (this->ptr - 1) T(std::forward<Args>(args)...); - } - --this->ptr; - ++this->size; - } }; } // namespace QtPrivate |