DiscBase: Mark member functions as const where applicable

These don't modify instance state, so they can be marked as const.
This commit is contained in:
Lioncash 2019-09-05 21:51:17 -04:00
parent 998d6a77c3
commit f443b60bde
1 changed files with 4 additions and 2 deletions

View File

@ -207,8 +207,8 @@ public:
using pointer = Node*;
using reference = Node&;
bool operator!=(const DirectoryIterator& other) { return m_it != other.m_it; }
bool operator==(const DirectoryIterator& other) { return m_it == other.m_it; }
bool operator==(const DirectoryIterator& other) const { return m_it == other.m_it; }
bool operator!=(const DirectoryIterator& other) const { return !operator==(other); }
DirectoryIterator& operator++() {
if (m_it->m_kind == Kind::Directory)
m_it = m_it->rawEnd();
@ -217,7 +217,9 @@ public:
return *this;
}
Node& operator*() { return *m_it; }
const Node& operator*() const { return *m_it; }
Node* operator->() { return &*m_it; }
const Node* operator->() const { return &*m_it; }
};
DirectoryIterator begin() const { return DirectoryIterator(m_childrenBegin); }
DirectoryIterator end() const { return DirectoryIterator(m_childrenEnd); }