diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common.hpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/common.hpp b/src/common.hpp index 7f7dbcb7..bea299bf 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -133,11 +133,34 @@ struct LList const LList* m_prev; T m_item; + LList(): + m_prev(nullptr) + {} LList(const LList* prev, T item): m_prev(prev), m_item( ::std::move(item) ) { - }; + } + + LList end() const { + return LList(); + } + LList begin() const { + return *this; + } + bool operator==(const LList& x) { + return m_prev == x.m_prev; + } + bool operator!=(const LList& x) { + return m_prev != x.m_prev; + } + void operator++() { + assert(m_prev); + *this = *m_prev; + } + const T& operator*() const { + return m_item; + } }; template<typename T> |