AK: Add at() indexing methods to FixedArray

This commit is contained in:
kleines Filmröllchen 2022-02-23 11:32:28 +01:00 committed by Ali Mohammad Pur
parent 09df8f812a
commit 75eb5e7984
Notes: sideshowbarker 2024-07-17 18:11:52 +09:00

View file

@ -128,18 +128,28 @@ public:
T* data() { return m_elements; }
T const* data() const { return m_elements; }
T& operator[](size_t index)
T& at(size_t index)
{
VERIFY(index < m_size);
return m_elements[index];
}
T const& operator[](size_t index) const
T const& at(size_t index) const
{
VERIFY(index < m_size);
return m_elements[index];
}
T& operator[](size_t index)
{
return at(index);
}
T const& operator[](size_t index) const
{
return at(index);
}
bool contains_slow(T const& value) const
{
for (size_t i = 0; i < m_size; ++i) {