mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 04:22:28 +00: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: 86c6fec890
1 changed files with 8 additions and 0 deletions
|
@ -527,6 +527,14 @@ public:
|
||||||
return find([&](auto& other) { return value == other; });
|
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:
|
private:
|
||||||
void reset_capacity()
|
void reset_capacity()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue