Merge pull request #100563 from Ivorforce/move-semantics-list
Add move semantics (constructor, operator=) to `List`.
This commit is contained in:
@ -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() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user