diff options
author | Brad King <brad.king@kitware.com> | 2017-10-11 12:23:01 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-10-11 12:24:23 (GMT) |
commit | 5fd0ce61f71ff84c51e1ad25ebd53fd1e2444d8c (patch) | |
tree | c962a7c547d5a8537fbf376f8e2ad1166715d151 | |
parent | 86edb6660b8b938cf291e69cc73e01fc30c69809 (diff) | |
parent | ff09abb8dbd8f71a445615c08da9d099b8a063db (diff) | |
download | CMake-5fd0ce61f71ff84c51e1ad25ebd53fd1e2444d8c.zip CMake-5fd0ce61f71ff84c51e1ad25ebd53fd1e2444d8c.tar.gz CMake-5fd0ce61f71ff84c51e1ad25ebd53fd1e2444d8c.tar.bz2 |
Merge topic 'linked-tree'
ff09abb8 cmLinkedTree: avoid unnecessary copies during Push of T
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1351
-rw-r--r-- | Source/cmLinkedTree.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h index 8865e23..975f052 100644 --- a/Source/cmLinkedTree.h +++ b/Source/cmLinkedTree.h @@ -137,7 +137,7 @@ public: iterator Push(iterator it) { return Push_impl(it, T()); } - iterator Push(iterator it, T t) { return Push_impl(it, t); } + iterator Push(iterator it, T t) { return Push_impl(it, std::move(t)); } bool IsLast(iterator it) { return it.Position == this->Data.size(); } @@ -177,12 +177,12 @@ private: T* GetPointer(PositionType pos) { return &this->Data[pos]; } - iterator Push_impl(iterator it, T t) + iterator Push_impl(iterator it, T&& t) { assert(this->UpPositions.size() == this->Data.size()); assert(it.Position <= this->UpPositions.size()); this->UpPositions.push_back(it.Position); - this->Data.push_back(t); + this->Data.push_back(std::move(t)); return iterator(this, this->UpPositions.size()); } |