From 75eb5e79848b2340e94507955cb6314c21a8dbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Wed, 23 Feb 2022 11:32:28 +0100 Subject: [PATCH] AK: Add at() indexing methods to FixedArray --- AK/FixedArray.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/AK/FixedArray.h b/AK/FixedArray.h index 38725cd68d..5708a67b69 100644 --- a/AK/FixedArray.h +++ b/AK/FixedArray.h @@ -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) {