From 0df8378971553a203cc6982a298f342baecae543 Mon Sep 17 00:00:00 2001 From: Gil Date: Thu, 19 Apr 2018 11:30:29 -0700 Subject: Implement iterators for our immutable maps (#1132) * Add a minimal LlrbNodeIterator * Remove fixed_size type parameter from FixedArray The parameter wasn't that useful and caused problems in trying to define dependent iterator types. * Add begin()/end() to SortedMap. --- .../core/src/firebase/firestore/immutable/array_sorted_map.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h') diff --git a/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h b/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h index adba962..6808297 100644 --- a/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h +++ b/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h @@ -47,13 +47,12 @@ namespace impl { * to a FixedArray. * * @tparam T The type of an element in the array. - * @tparam fixed_size the fixed size to use in creating the FixedArray. */ -template +template class FixedArray { public: using size_type = SortedMapBase::size_type; - using array_type = std::array; + using array_type = std::array; using iterator = typename array_type::iterator; using const_iterator = typename array_type::const_iterator; @@ -73,7 +72,7 @@ class FixedArray { void append(SourceIterator src_begin, SourceIterator src_end) { auto appending = static_cast(src_end - src_begin); auto new_size = size_ + appending; - FIREBASE_ASSERT(new_size <= fixed_size); + FIREBASE_ASSERT(new_size <= SortedMapBase::kFixedSize); std::copy(src_begin, src_end, end()); size_ = new_size; @@ -84,7 +83,7 @@ class FixedArray { */ void append(T&& value) { size_type new_size = size_ + 1; - FIREBASE_ASSERT(new_size <= fixed_size); + FIREBASE_ASSERT(new_size <= SortedMapBase::kFixedSize); *end() = std::move(value); size_ = new_size; @@ -132,7 +131,7 @@ class ArraySortedMap : public SortedMapBase { /** * The type of the fixed-size array containing entries of value_type. */ - using array_type = FixedArray; + using array_type = FixedArray; using const_iterator = typename array_type::const_iterator; using array_pointer = std::shared_ptr; -- cgit v1.2.3