mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 21:54:40 +03:00
AK: Add Vector::find_first_index(const T&)
This commit is contained in:
parent
3012b224f0
commit
86c6fec890
Notes:
sideshowbarker
2024-07-19 10:48:47 +09:00
Author: https://github.com/asliturk Commit: https://github.com/SerenityOS/serenity/commit/86c6fec890d
@ -527,6 +527,14 @@ public:
|
||||
return find([&](auto& other) { return value == other; });
|
||||
}
|
||||
|
||||
int find_first_index(const T& value)
|
||||
{
|
||||
for (int i = 0; i < m_size; ++i) {
|
||||
if (value == at(i))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
private:
|
||||
void reset_capacity()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user