Adds copy and assignment operators for Dictionary
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
74e3cb36a7
commit
94ca0327ef
|
@ -26,6 +26,16 @@ namespace ArbUt {
|
||||||
/// @brief Initialises a dictionary from an initializer_list.
|
/// @brief Initialises a dictionary from an initializer_list.
|
||||||
Dictionary(const std::initializer_list<std::pair<const KeyT, ValueT>>& l)
|
Dictionary(const std::initializer_list<std::pair<const KeyT, ValueT>>& l)
|
||||||
: _map(new std::unordered_map<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.
|
/// @brief Removes all items from the dictionary.
|
||||||
inline void Clear() noexcept { _map->clear(); }
|
inline void Clear() noexcept { _map->clear(); }
|
||||||
|
|
Loading…
Reference in New Issue