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.
This commit is contained in:
Andreas Kling 2020-06-23 19:48:02 +02:00
parent 5ac19ca4fd
commit 72eb13d8e4
Notes: sideshowbarker 2024-07-19 05:25:14 +09:00

View file

@ -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(); }