Adds copy and assignment operators for Dictionary
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2022-03-20 11:39:00 +01:00
parent 74e3cb36a7
commit 94ca0327ef
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 10 additions and 0 deletions

View File

@ -26,6 +26,16 @@ namespace ArbUt {
/// @brief Initialises a dictionary from an initializer_list.
Dictionary(const std::initializer_list<std::pair<const KeyT, ValueT>>& l)
: _map(new std::unordered_map<KeyT, ValueT>(l)) {}
/// @brief Copy operator
Dictionary(const Dictionary& other) noexcept : _map(other._map) {}
/// @brief Assignment operator
Dictionary& operator=(const Dictionary& other) noexcept {
if (this == &other || _map == other._map) {
return *this;
}
_map = other._map;
return *this;
}
/// @brief Removes all items from the dictionary.
inline void Clear() noexcept { _map->clear(); }