FTL: Add clear() to containers
Bug: 185536303
Test: ftl_test
Change-Id: Icc13d1dcfdc006fd26a418e4904e5d2ce12724dd
diff --git a/include/ftl/small_map.h b/include/ftl/small_map.h
index bcaba82..988431a 100644
--- a/include/ftl/small_map.h
+++ b/include/ftl/small_map.h
@@ -237,6 +237,12 @@
//
bool erase(const key_type& key) { return erase(key, begin()); }
+ // Removes all mappings.
+ //
+ // All iterators are invalidated.
+ //
+ void clear() { map_.clear(); }
+
private:
iterator find(const key_type& key, iterator first) {
return std::find_if(first, end(), [&key](const auto& pair) { return pair.first == key; });