mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
AK: Add Vector::find_first_index(const T&)
This commit is contained in:
parent
3012b224f0
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