Merge pull request #100563 from Ivorforce/move-semantics-list

Add move semantics (constructor, operator=) to `List`.
This commit is contained in:
Thaddeus Crews 2024-12-19 19:59:54 -06:00
commit 92615f24e7
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84

View file

@ -524,6 +524,15 @@ public:
it = it->next();
}
}
void operator=(List &&p_list) {
if (unlikely(this == &p_list)) {
return;
}
clear();
_data = p_list._data;
p_list._data = nullptr;
}
// Random access to elements, use with care,
// do not use for iteration.
@ -762,6 +771,10 @@ public:
it = it->next();
}
}
List(List &&p_list) {
_data = p_list._data;
p_list._data = nullptr;
}
List() {}