diff options
Diffstat (limited to 'source/blender/blenlib/BLI_map.hh')
-rw-r--r-- | source/blender/blenlib/BLI_map.hh | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh index a4c3ee76ca1..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 { @@ -98,7 +98,7 @@ template< */ uint32_t InlineBufferCapacity = (sizeof(Key) + sizeof(Value) < 100) ? 4 : 0, /** - * The strategy used to deal with collistions. They are defined in BLI_probing_strategies.hh. + * The strategy used to deal with collisions. They are defined in BLI_probing_strategies.hh. */ typename ProbingStrategy = DefaultProbingStrategy, /** @@ -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)); } @@ -641,7 +641,7 @@ class Map { */ template<typename FuncT> void foreach_item(const FuncT &func) const { - uint32_t size = this->size(); + uint32_t size = m_slots.size(); for (uint32_t i = 0; i < size; i++) { const Slot &slot = m_slots[i]; if (slot.is_occupied()) { @@ -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; |