Implements clear functions on Dictionary and List.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-03-22 17:14:51 +01:00
parent 5e9ffa0d69
commit 1f882b9596
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,10 @@ namespace Arbutils::Collections {
explicit Dictionary(size_t capacity) : _map(capacity) {} explicit Dictionary(size_t capacity) : _map(capacity) {}
explicit Dictionary(const std::initializer_list<std::pair<const KeyT, ValueT>>& l) : _map(l){} explicit Dictionary(const std::initializer_list<std::pair<const KeyT, ValueT>>& l) : _map(l){}
inline void Clear(){
_map.clear();
}
inline void Insert(KeyT key, ValueT value) { inline void Insert(KeyT key, ValueT value) {
auto v = _map.insert({key, value}); auto v = _map.insert({key, value});
#ifndef NO_ASSERT #ifndef NO_ASSERT

View File

@ -16,6 +16,10 @@ namespace Arbutils::Collections {
explicit List(size_t capacity) : _vector(capacity) {} explicit List(size_t capacity) : _vector(capacity) {}
List(const std::initializer_list<ValueT>& l) : _vector(l) {} List(const std::initializer_list<ValueT>& l) : _vector(l) {}
inline void Clear(){
_vector.clear();
}
inline const ValueT& At(size_t index) const { inline const ValueT& At(size_t index) const {
#ifndef NO_ASSERT #ifndef NO_ASSERT
if (index >= _vector.size()) { if (index >= _vector.size()) {