mirror of https://github.com/godotengine/godot
Add move semantics (constructor, operator=) to `List`.
This commit is contained in:
parent
2b7ea6223b
commit
19992e3284
|
|
@ -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() {}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue