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 | 20 |
1 files changed, 17 insertions, 3 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 dac07b4..609b9da 100644 --- a/Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h +++ b/Firestore/core/src/firebase/firestore/immutable/tree_sorted_map.h @@ -106,9 +106,8 @@ class TreeSortedMap : public SortedMapBase, private util::ComparatorHolder<C> { * @return A new map without that value. */ TreeSortedMap erase(const K& key) const { - // TODO(wilhuff): Actually implement erase - (void)key; - return TreeSortedMap{this->comparator()}; + const C& comparator = this->comparator(); + return TreeSortedMap{root_.erase(key, comparator), comparator}; } bool contains(const K& key) const { @@ -172,6 +171,21 @@ class TreeSortedMap : public SortedMapBase, private util::ComparatorHolder<C> { return npos; } + const_iterator min() const { + return begin(); + } + + const_iterator max() const { + if (empty()) { + return end(); + } + + const node_type& max_node = root_.max(); + typename const_iterator::stack_type stack; + stack.push(&max_node); + return const_iterator{std::move(stack)}; + } + /** * Returns a forward iterator pointing to the first entry in the map. If there * are no entries in the map, begin() == end(). |