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:
Diffstat (limited to 'source/blender/blenlib/BLI_resource_collector.hh')
-rw-r--r--source/blender/blenlib/BLI_resource_collector.hh7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_resource_collector.hh b/source/blender/blenlib/BLI_resource_collector.hh
index ecae9b8c682..70804ceb1f1 100644
--- a/source/blender/blenlib/BLI_resource_collector.hh
+++ b/source/blender/blenlib/BLI_resource_collector.hh
@@ -130,9 +130,10 @@ class ResourceCollector : NonCopyable, NonMovable {
*/
template<typename T, typename... Args> T &construct(const char *name, Args &&... args)
{
- T *value = m_allocator.construct<T>(std::forward<Args>(args)...);
- this->add(destruct_ptr<T>(value), name);
- return *value;
+ destruct_ptr<T> value_ptr = m_allocator.construct<T>(std::forward<Args>(args)...);
+ T &value_ref = *value_ptr;
+ this->add(std::move(value_ptr), name);
+ return value_ref;
}
/**