mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
AK: Add assertions to FixedArray::operator[]
Let's catch ourselves if we ever index out of bounds into one of these.
This commit is contained in:
@@ -45,8 +45,17 @@ public:
|
|||||||
|
|
||||||
size_t size() const { return m_size; }
|
size_t size() const { return m_size; }
|
||||||
|
|
||||||
T& operator[](size_t index) { return m_elements[index]; }
|
T& operator[](size_t index)
|
||||||
const T& operator[](size_t index) const { return m_elements[index]; }
|
{
|
||||||
|
ASSERT(index < m_size);
|
||||||
|
return m_elements[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
const T& operator[](size_t index) const
|
||||||
|
{
|
||||||
|
ASSERT(index < m_size);
|
||||||
|
return m_elements[index];
|
||||||
|
}
|
||||||
|
|
||||||
void resize(size_t new_size)
|
void resize(size_t new_size)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user