aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2018-04-19 11:30:29 -0700
committerGravatar GitHub <noreply@github.com>2018-04-19 11:30:29 -0700
commit0df8378971553a203cc6982a298f342baecae543 (patch)
tree0db33e6bea1cb4ed6ca74ad299eb868bdb943693 /Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h
parent81ac1761e2195aa2f16c0377471e084910ccdb35 (diff)
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.
Diffstat (limited to 'Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h')
-rw-r--r--Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h11
1 files changed, 5 insertions, 6 deletions
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 <typename T, SortedMapBase::size_type fixed_size>
+template <typename T>
class FixedArray {
public:
using size_type = SortedMapBase::size_type;
- using array_type = std::array<T, fixed_size>;
+ using array_type = std::array<T, SortedMapBase::kFixedSize>;
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<size_type>(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<value_type, kFixedSize>;
+ using array_type = FixedArray<value_type>;
using const_iterator = typename array_type::const_iterator;
using array_pointer = std::shared_ptr<const array_type>;