AK: Add Vector::find_first_index(const T&)

This commit is contained in:
Hüseyin ASLITÜRK 2019-12-18 00:15:36 +03:00 committed by Andreas Kling
parent 3012b224f0
commit 86c6fec890
Notes: sideshowbarker 2024-07-19 10:48:47 +09:00

View File

@ -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()
{