From 1f882b95967cdbcf6077cf179f9ad6811efec114 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 22 Mar 2020 17:14:51 +0100 Subject: [PATCH] Implements clear functions on Dictionary and List. --- src/Collections/Dictionary.hpp | 4 ++++ src/Collections/List.hpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Collections/Dictionary.hpp b/src/Collections/Dictionary.hpp index 46fd652..5c793cf 100644 --- a/src/Collections/Dictionary.hpp +++ b/src/Collections/Dictionary.hpp @@ -14,6 +14,10 @@ namespace Arbutils::Collections { explicit Dictionary(size_t capacity) : _map(capacity) {} explicit Dictionary(const std::initializer_list>& l) : _map(l){} + inline void Clear(){ + _map.clear(); + } + inline void Insert(KeyT key, ValueT value) { auto v = _map.insert({key, value}); #ifndef NO_ASSERT diff --git a/src/Collections/List.hpp b/src/Collections/List.hpp index 054f3e4..d28c411 100644 --- a/src/Collections/List.hpp +++ b/src/Collections/List.hpp @@ -16,6 +16,10 @@ namespace Arbutils::Collections { explicit List(size_t capacity) : _vector(capacity) {} List(const std::initializer_list& l) : _vector(l) {} + inline void Clear(){ + _vector.clear(); + } + inline const ValueT& At(size_t index) const { #ifndef NO_ASSERT if (index >= _vector.size()) {