AK: Mark SimpleIterator::operator*() as ALWAYS_INLINE

This gives the compiler enough information to optimize index validation
when using range-for to iterate over a Vector, drastically reducing the
cost of such loops.
This commit is contained in:
Andreas Kling 2020-11-14 17:15:35 +01:00
parent c4933f9bd7
commit a5982f8605
Notes: sideshowbarker 2024-07-19 02:27:57 +09:00

View file

@ -72,8 +72,8 @@ public:
return SimpleIterator { m_container, m_index + 1 };
}
constexpr const ValueType& operator*() const { return m_container[m_index]; }
constexpr ValueType& operator*() { return m_container[m_index]; }
ALWAYS_INLINE constexpr const ValueType& operator*() const { return m_container[m_index]; }
ALWAYS_INLINE constexpr ValueType& operator*() { return m_container[m_index]; }
constexpr const ValueType* operator->() const { return &m_container[m_index]; }
constexpr ValueType* operator->() { return &m_container[m_index]; }