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

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() {}