AK: Add SinglyLinkedListIterator::is_begin()

It's useful to be able to tell if we are at the beginning of
the list when using the list as a queue.
This commit is contained in:
Brian Gianforcaro 2020-04-26 13:57:47 -07:00 committed by Andreas Kling
parent 36c00e8078
commit 74f3263cea
Notes: sideshowbarker 2024-07-19 07:15:07 +09:00

View file

@ -46,6 +46,7 @@ public:
ElementType& operator*() { return m_node->value; } ElementType& operator*() { return m_node->value; }
ElementType* operator->() { return &m_node->value; } ElementType* operator->() { return &m_node->value; }
bool is_end() const { return !m_node; } bool is_end() const { return !m_node; }
bool is_begin() const { return !m_prev; }
private: private:
friend ListType; friend ListType;