|
|
@@ -68,15 +68,14 @@ class basic_registry {
|
|
|
|
|
|
template<typename... Args>
|
|
|
decltype(auto) assign(basic_registry &owner, const Entity entt, Args &&... args) {
|
|
|
- decltype(auto) component = storage<entity_type, Component>::construct(entt, std::forward<Args>(args)...);
|
|
|
- construction.publish(entt, owner, component);
|
|
|
- return component;
|
|
|
+ construction.publish(entt, owner, this->construct(entt, std::forward<Args>(args)...));
|
|
|
+ return this->get(entt);
|
|
|
}
|
|
|
|
|
|
template<typename It, typename... Args>
|
|
|
std::enable_if_t<std::is_same_v<typename std::iterator_traits<It>::value_type, Entity>, typename storage<Entity, Component>::reverse_iterator_type>
|
|
|
assign(basic_registry &owner, It first, It last, Args &&... args) {
|
|
|
- auto it = storage<entity_type, Component>::construct(first, last, std::forward<Args>(args)...);
|
|
|
+ auto it = this->construct(first, last, std::forward<Args>(args)...);
|
|
|
const auto end = it + (!construction.empty() * std::distance(first, last));
|
|
|
|
|
|
std::for_each(it, end, [this, &owner, &first](decltype(*it) component) {
|
|
|
@@ -88,14 +87,14 @@ class basic_registry {
|
|
|
|
|
|
void remove(basic_registry &owner, const Entity entt) {
|
|
|
destruction.publish(entt, owner);
|
|
|
- storage<entity_type, Component>::destroy(entt);
|
|
|
+ this->destroy(entt);
|
|
|
}
|
|
|
|
|
|
template<typename... Args>
|
|
|
decltype(auto) replace(basic_registry &owner, const Entity entt, Args &&... args) {
|
|
|
Component component{std::forward<Args>(args)...};
|
|
|
update.publish(entt, owner, component);
|
|
|
- return (storage<entity_type, Component>::get(entt) = std::move(component));
|
|
|
+ return (this->get(entt) = std::move(component));
|
|
|
}
|
|
|
|
|
|
private:
|