BAN: Implement ConstIteratorDouble and add it to HashMap

This is same as IteratorDouble except it uses const_iterator and does
not return non-const references.
This commit is contained in:
2023-07-12 11:41:05 +03:00
parent 65424a6769
commit 9eab6710ce
2 changed files with 104 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ namespace BAN
using key_type = Key;
using value_type = T;
using iterator = IteratorDouble<Entry, Vector, LinkedList, HashMap>;
using const_iterator = ConstIteratorDouble<Entry, Vector, LinkedList, HashMap>;
public:
HashMap() = default;
@@ -48,6 +49,8 @@ namespace BAN
iterator begin() { return iterator(m_buckets.end(), m_buckets.begin()); }
iterator end() { return iterator(m_buckets.end(), m_buckets.end()); }
const_iterator begin() const { return const_iterator(m_buckets.end(), m_buckets.begin()); }
const_iterator end() const { return const_iterator(m_buckets.end(), m_buckets.end()); }
ErrorOr<void> reserve(size_type);