Changeset View
Changeset View
Standalone View
Standalone View
source/blender/functions/FN_generic_value_map.hh
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | public: | ||||
| /* Remove the value for the given name from the container and remove it. The caller is | /* Remove the value for the given name from the container and remove it. The caller is | ||||
| * responsible for freeing it. The lifetime of the referenced memory might be bound to lifetime | * responsible for freeing it. The lifetime of the referenced memory might be bound to lifetime | ||||
| * of the container. */ | * of the container. */ | ||||
| template<typename ForwardKey> GMutablePointer extract(const ForwardKey &key) | template<typename ForwardKey> GMutablePointer extract(const ForwardKey &key) | ||||
| { | { | ||||
| return values_.pop_as(key); | return values_.pop_as(key); | ||||
| } | } | ||||
| template<typename ForwardKey> GPointer lookup(const ForwardKey &key) const | |||||
| { | |||||
| return values_.lookup_as(key); | |||||
| } | |||||
| /* Remove the value for the given name from the container and remove it. */ | /* Remove the value for the given name from the container and remove it. */ | ||||
| template<typename T, typename ForwardKey> T extract(const ForwardKey &key) | template<typename T, typename ForwardKey> T extract(const ForwardKey &key) | ||||
| { | { | ||||
| GMutablePointer value = values_.pop_as(key); | GMutablePointer value = values_.pop_as(key); | ||||
| const CPPType &type = *value.type(); | const CPPType &type = *value.type(); | ||||
| BLI_assert(type.is<T>()); | BLI_assert(type.is<T>()); | ||||
| T return_value; | T return_value; | ||||
| type.relocate_to_initialized(value.get(), &return_value); | type.relocate_to_initialized(value.get(), &return_value); | ||||
| Show All 18 Lines | |||||