mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Add a const version of List::find
This commit is contained in:
parent
e47fb8b898
commit
6f207a4601
1 changed files with 13 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue