-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
gecs/src/gecs/entity/commands.hpp
Lines 79 to 81 in b720a46
auto& on_construct() noexcept { | |
return reg_->template on_construct<T>(); | |
} |
gecs/src/gecs/entity/commands.hpp
Lines 84 to 86 in b720a46
auto& on_update() noexcept { | |
return reg_->template on_update<T>(); | |
} |
gecs/src/gecs/entity/commands.hpp
Lines 89 to 91 in b720a46
auto& on_destruct() noexcept { | |
return reg_->template on_destruct<T>(); | |
} |
其中reg_->template on_construct<T>()
,reg_->template on_update<T>()
和reg_->template on_destruct<T>()
返回的都是一个sink
的临时变量,从而导致返回了悬垂引用,后续对这些悬垂引用的使用都是UB。
直接返回值就行了,编译器会执行RVO的。
Metadata
Metadata
Assignees
Labels
No labels