This commit is contained in:
2 files changed
+7
-10
No files matched your search
@@ -46,13 +46,12 @@ namespace ArbUt {
|
||||
|
||||
/// @brief Try to get an item from the dictionary using a key. Returns false if no item is found, and out will
|
||||
/// not be touched in that case.
|
||||
inline bool TryGet(const KeyT& key, ValueT& out) const noexcept {
|
||||
inline std::optional<std::reference_wrapper<const ValueT>> TryGet(const KeyT& key) const noexcept {
|
||||
const auto& find = _map.find(key);
|
||||
if (find == _map.end()) {
|
||||
return false;
|
||||
return {};
|
||||
}
|
||||
out = find->second;
|
||||
return true;
|
||||
return std::ref(find->second);
|
||||
}
|
||||
|
||||
/// @brief Removes an item with a certain key from the dictionary
|
||||
|
||||
Reference in new issue
Block a user