This commit is contained in:
@@ -11,14 +11,13 @@ namespace Arbutils::Collections {
|
||||
|
||||
using iterator = typename std::unordered_map<KeyT, ValueT>::iterator;
|
||||
using const_iterator = typename std::unordered_map<KeyT, ValueT>::const_iterator;
|
||||
|
||||
public:
|
||||
Dictionary() : _map() {}
|
||||
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 Clear() { _map.clear(); }
|
||||
|
||||
inline void Insert(const KeyT& key, const ValueT& value) {
|
||||
[[maybe_unused]] const auto& v = _map.insert({key, value});
|
||||
@@ -28,7 +27,6 @@ namespace Arbutils::Collections {
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline void Set(const KeyT& key, const ValueT& value) { _map[key] = value; }
|
||||
|
||||
[[nodiscard]] inline ValueT& Get(const KeyT& key) {
|
||||
@@ -39,9 +37,7 @@ namespace Arbutils::Collections {
|
||||
#endif
|
||||
}
|
||||
|
||||
[[nodiscard]] inline const ValueT& Get(const KeyT& key) const {
|
||||
return _map.at(key);
|
||||
}
|
||||
[[nodiscard]] inline const ValueT& Get(const KeyT& key) const { return _map.at(key); }
|
||||
|
||||
inline bool TryGet(const KeyT& key, ValueT& out) const {
|
||||
const auto& find = _map.find(key);
|
||||
@@ -52,9 +48,7 @@ namespace Arbutils::Collections {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void Remove(const KeyT& key){
|
||||
_map.erase(key);
|
||||
}
|
||||
inline void Remove(const KeyT& key) { _map.erase(key); }
|
||||
|
||||
[[nodiscard]] inline size_t Count() const { return _map.size(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user