Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_map_slots.hh
| Show First 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | bool contains(const ForwardKey &key, const IsEqual &is_equal, uint64_t UNUSED(hash)) const | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Change the state of this slot from empty/removed to occupied. The key/value has to be | * Change the state of this slot from empty/removed to occupied. The key/value has to be | ||||
| * constructed by calling the constructor with the given key/value as parameter. | * constructed by calling the constructor with the given key/value as parameter. | ||||
| */ | */ | ||||
| template<typename ForwardKey, typename ForwardValue> | template<typename ForwardKey, typename... ForwardValue> | ||||
| void occupy(ForwardKey &&key, ForwardValue &&value, uint64_t hash) | void occupy(ForwardKey &&key, uint64_t hash, ForwardValue &&... value) | ||||
| { | { | ||||
| BLI_assert(!this->is_occupied()); | BLI_assert(!this->is_occupied()); | ||||
| new (&value_buffer_) Value(std::forward<ForwardValue>(value)); | new (&value_buffer_) Value(std::forward<ForwardValue>(value)...); | ||||
| this->occupy_no_value(std::forward<ForwardKey>(key), hash); | this->occupy_no_value(std::forward<ForwardKey>(key), hash); | ||||
| state_ = Occupied; | state_ = Occupied; | ||||
| } | } | ||||
| /** | /** | ||||
| * Change the state of this slot from empty/removed to occupied. The value is assumed to be | * Change the state of this slot from empty/removed to occupied. The value is assumed to be | ||||
| * constructed already. | * constructed already. | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | public: | ||||
| template<typename ForwardKey, typename IsEqual> | template<typename ForwardKey, typename IsEqual> | ||||
| bool contains(const ForwardKey &key, const IsEqual &is_equal, uint64_t UNUSED(hash)) const | bool contains(const ForwardKey &key, const IsEqual &is_equal, uint64_t UNUSED(hash)) const | ||||
| { | { | ||||
| BLI_assert(KeyInfo::is_not_empty_or_removed(key)); | BLI_assert(KeyInfo::is_not_empty_or_removed(key)); | ||||
| return is_equal(key, key_); | return is_equal(key, key_); | ||||
| } | } | ||||
| template<typename ForwardKey, typename ForwardValue> | template<typename ForwardKey, typename... ForwardValue> | ||||
| void occupy(ForwardKey &&key, ForwardValue &&value, uint64_t hash) | void occupy(ForwardKey &&key, uint64_t hash, ForwardValue &&... value) | ||||
| { | { | ||||
| BLI_assert(!this->is_occupied()); | BLI_assert(!this->is_occupied()); | ||||
| BLI_assert(KeyInfo::is_not_empty_or_removed(key)); | BLI_assert(KeyInfo::is_not_empty_or_removed(key)); | ||||
| new (&value_buffer_) Value(std::forward<ForwardValue>(value)); | new (&value_buffer_) Value(std::forward<ForwardValue>(value)...); | ||||
| this->occupy_no_value(std::forward<ForwardKey>(key), hash); | this->occupy_no_value(std::forward<ForwardKey>(key), hash); | ||||
| } | } | ||||
| template<typename ForwardKey> void occupy_no_value(ForwardKey &&key, uint64_t UNUSED(hash)) | template<typename ForwardKey> void occupy_no_value(ForwardKey &&key, uint64_t UNUSED(hash)) | ||||
| { | { | ||||
| BLI_assert(!this->is_occupied()); | BLI_assert(!this->is_occupied()); | ||||
| BLI_assert(KeyInfo::is_not_empty_or_removed(key)); | BLI_assert(KeyInfo::is_not_empty_or_removed(key)); | ||||
| try { | try { | ||||
| Show All 34 Lines | |||||