summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-11 12:23:01 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-10-11 12:24:23 (GMT)
commit5fd0ce61f71ff84c51e1ad25ebd53fd1e2444d8c (patch)
treec962a7c547d5a8537fbf376f8e2ad1166715d151
parent86edb6660b8b938cf291e69cc73e01fc30c69809 (diff)
parentff09abb8dbd8f71a445615c08da9d099b8a063db (diff)
downloadCMake-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.h6
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());
}