From 72eb13d8e447af80bb8bec7f8b6e0ec3c6c2c849 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Jun 2020 19:48:02 +0200 Subject: [PATCH] AK: Inline the basics of VectorIterator Inlining these allows the compiler to optimize out the assertions in favor of a static range check in many cases. --- AK/Vector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AK/Vector.h b/AK/Vector.h index 1c0c0385f6d..eb31c6282ba 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -54,7 +54,7 @@ public: bool operator<(const VectorIterator& other) const { return m_index < other.m_index; } bool operator>(const VectorIterator& other) const { return m_index > other.m_index; } bool operator>=(const VectorIterator& other) const { return m_index >= other.m_index; } - VectorIterator& operator++() + ALWAYS_INLINE VectorIterator& operator++() { ++m_index; return *this; @@ -71,7 +71,7 @@ public: m_index = other.m_index; return *this; } - ElementType& operator*() { return m_vector[m_index]; } + ALWAYS_INLINE ElementType& operator*() { return m_vector[m_index]; } size_t operator-(const VectorIterator& other) { return m_index - other.m_index; } bool is_end() const { return m_index == m_vector.size(); }