mirror of
https://github.com/reactos/CMake.git
synced 2025-02-13 08:06:16 +00:00
cmLinkedTree: avoid unnecessary copies during Push of T
This commit is contained in:
parent
cb8f26f199
commit
ff09abb8db
@ -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());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user