diff options
Diffstat (limited to 'Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h')
-rw-r--r-- | Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h b/Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h index ff8c9f9..c5eddc2 100644 --- a/Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h +++ b/Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h @@ -51,6 +51,7 @@ class TreeSortedMap : public SortedMapBase, private util::ComparatorHolder<C> { * The type of the node containing entries of value_type. */ using node_type = LlrbNode<K, V>; + using const_iterator = typename node_type::const_iterator; /** * Creates an empty TreeSortedMap. @@ -110,6 +111,23 @@ class TreeSortedMap : public SortedMapBase, private util::ComparatorHolder<C> { return root_; } + /** + * Returns a forward iterator pointing to the first entry in the map. If there + * are no entries in the map, begin() == end(). + * + * See LlrbNodeIterator for details + */ + const_iterator begin() const { + return const_iterator::Begin(&root_); + } + + /** + * Returns an iterator pointing past the last entry in the map. + */ + const_iterator end() const { + return const_iterator::End(); + } + private: TreeSortedMap(node_type&& root, const C& comparator) noexcept : util::ComparatorHolder<C>{comparator}, root_{std::move(root)} { |