summaryrefslogtreecommitdiffstats
path: root/Source/cmLinkedTree.h
diff options
context:
space:
mode:
authorMatthias Maennich <matthias@maennich.net>2017-10-04 17:34:36 (GMT)
committerMatthias Maennich <matthias@maennich.net>2017-10-09 08:23:14 (GMT)
commitff09abb8dbd8f71a445615c08da9d099b8a063db (patch)
treed9212b7d8c4682380179ba943638a5a807ced8cb /Source/cmLinkedTree.h
parentcb8f26f199e18be231f40f523bfe64375e749e35 (diff)
downloadCMake-ff09abb8dbd8f71a445615c08da9d099b8a063db.zip
CMake-ff09abb8dbd8f71a445615c08da9d099b8a063db.tar.gz
CMake-ff09abb8dbd8f71a445615c08da9d099b8a063db.tar.bz2
cmLinkedTree: avoid unnecessary copies during Push of T
Diffstat (limited to 'Source/cmLinkedTree.h')
-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());
}