mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-06 16:09:30 +00:00
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:
parent
c4933f9bd7
commit
a5982f8605
|
@ -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]; }
|
||||
|
|
Loading…
Reference in a new issue