Add move semantics (constructor, operator=) to List.

This commit is contained in:
Lukas Tenbrink 2024-12-18 16:46:30 +01:00
parent 2b7ea6223b
commit 19992e3284

View File

@ -522,6 +522,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.
@ -760,6 +769,10 @@ public:
it = it->next();
}
}
List(List &&p_list) {
_data = p_list._data;
p_list._data = nullptr;
}
List() {}