pw_kvs: Fix iterator
Change-Id: I11dde4d584d750c8e1e85303cae5aab070c90677
diff --git a/pw_kvs/public/pw_kvs/key_value_store.h b/pw_kvs/public/pw_kvs/key_value_store.h
index d109f22..6efa73b 100644
--- a/pw_kvs/public/pw_kvs/key_value_store.h
+++ b/pw_kvs/public/pw_kvs/key_value_store.h
@@ -42,9 +42,8 @@
} // namespace internal
-// Traits class to detect if the type is a span. std::is_same is insufficient
-// because span is a class template. This is used to ensure that the correct
-// overload of the Put function is selected.
+// Traits class to detect if the type is a span. This is used to ensure that the
+// correct overload of the Put function is selected.
template <typename T>
using ConvertsToSpan =
std::bool_constant<internal::ConvertsToSpan<std::remove_reference_t<T>>(0)>;
@@ -201,7 +200,7 @@
using const_iterator = Iterator;
Iterator begin() const { return Iterator(*this, 0); }
- Iterator end() const { return Iterator(*this, empty() ? 0 : size() - 1); }
+ Iterator end() const { return Iterator(*this, size()); }
// Returns the number of valid entries in the KeyValueStore.
size_t size() const { return key_descriptor_list_size_; }