Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-06-29 15:29:05 +0300
committerJacques Lucke <jacques@blender.org>2020-06-29 15:30:06 +0300
commit18bff53c997f5bfac0435b8a03ee967eed8c9e20 (patch)
treeb0d3b788a7e2a64f746ba96e3456f01d7b274ca2 /source/blender/blenlib/BLI_map.hh
parent4fc5233467b1c273cdb82b221d8faa53249b99c6 (diff)
BLI: remove blender::Optional in favor of std::optional
`std::optional` can be used now, because we switched to C++17.
Diffstat (limited to 'source/blender/blenlib/BLI_map.hh')
-rw-r--r--source/blender/blenlib/BLI_map.hh11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh
index 7d5c8b19a78..688f334001f 100644
--- a/source/blender/blenlib/BLI_map.hh
+++ b/source/blender/blenlib/BLI_map.hh
@@ -67,13 +67,13 @@
* interface as blender::Map. This is useful for benchmarking.
*/
+#include <optional>
#include <unordered_map>
#include "BLI_array.hh"
#include "BLI_hash.hh"
#include "BLI_hash_tables.hh"
#include "BLI_map_slots.hh"
-#include "BLI_optional.hh"
#include "BLI_probing_strategies.hh"
namespace blender {
@@ -392,7 +392,7 @@ class Map {
* Get the value that is stored for the given key and remove it from the map. If the key is not
* in the map, a value-less optional is returned.
*/
- Optional<Value> pop_try(const Key &key)
+ std::optional<Value> pop_try(const Key &key)
{
return this->pop_try_as(key);
}
@@ -400,7 +400,7 @@ class Map {
/**
* Same as `pop_try`, but accepts other key types that are supported by the hash function.
*/
- template<typename ForwardKey> Optional<Value> pop_try_as(const ForwardKey &key)
+ template<typename ForwardKey> std::optional<Value> pop_try_as(const ForwardKey &key)
{
return this->pop_try__impl(key, m_hash(key));
}
@@ -1074,11 +1074,12 @@ class Map {
MAP_SLOT_PROBING_END();
}
- template<typename ForwardKey> Optional<Value> pop_try__impl(const ForwardKey &key, uint32_t hash)
+ template<typename ForwardKey>
+ std::optional<Value> pop_try__impl(const ForwardKey &key, uint32_t hash)
{
MAP_SLOT_PROBING_BEGIN (hash, slot) {
if (slot.contains(key, m_is_equal, hash)) {
- Optional<Value> value = std::move(*slot.value());
+ std::optional<Value> value = std::move(*slot.value());
slot.remove();
m_removed_slots++;
return value;