mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
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:
parent
5ac19ca4fd
commit
72eb13d8e4
Notes:
sideshowbarker
2024-07-19 05:25:14 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/72eb13d8e44
1 changed files with 2 additions and 2 deletions
|
@ -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; }
|
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;
|
++m_index;
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
m_index = other.m_index;
|
m_index = other.m_index;
|
||||||
return *this;
|
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; }
|
size_t operator-(const VectorIterator& other) { return m_index - other.m_index; }
|
||||||
|
|
||||||
bool is_end() const { return m_index == m_vector.size(); }
|
bool is_end() const { return m_index == m_vector.size(); }
|
||||||
|
|
Loading…
Reference in a new issue