mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
Merge pull request #112660 from aaronfranke/list-find-const
Add a const version of `List::find`
This commit is contained in:
@@ -415,6 +415,19 @@ public:
|
||||
/**
|
||||
* find an element in the list,
|
||||
*/
|
||||
template <typename T_v>
|
||||
const Element *find(const T_v &p_val) const {
|
||||
const Element *it = front();
|
||||
while (it) {
|
||||
if (it->value == p_val) {
|
||||
return it;
|
||||
}
|
||||
it = it->next();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename T_v>
|
||||
Element *find(const T_v &p_val) {
|
||||
Element *it = front();
|
||||
|
||||
Reference in New Issue
Block a user