public:
Owned() = default;
- template<typename... Args>
- Owned(Handle<Entity>, Args &&...);
+ template<typename P, typename... Args>
+ Owned(Handle<P>, Args &&...);
- template<typename... Args>
- Owned(Entity &parent, Args &&... args): Owned(Handle<Entity>::from_object(&parent), std::forward<Args>(args)...) { }
+ template<typename P, typename... Args>
+ Owned(P &parent, Args &&... args): Owned(Handle<P>::from_object(&parent), std::forward<Args>(args)...) { }
Owned(Owned &&other): Handle<T>(other) { other.ptr = nullptr; }
Owned &operator=(Owned &&other);
template<typename T>
-template<typename... Args>
-Owned<T>::Owned(Handle<Entity> parent, Args &&... args)
+template<typename P, typename... Args>
+Owned<T>::Owned(Handle<P> parent, Args &&... args)
{
if(!parent)
throw std::invalid_argument("Owned::Owned");
- using DependentEntity = std::conditional_t<sizeof(T), Entity, Entity>;
- Handle<DependentEntity> dparent = parent;
-
- Pool<T> &pool = get_stage(*dparent).get_pools().template get_pool<T>();
+ Pool<T> &pool = get_stage(*parent).get_pools().template get_pool<T>();
this->ptr = pool.create(parent, std::forward<Args>(args)...);
if constexpr(std::is_base_of_v<Component, T>)
- dparent->add_component(*this);
+ parent->add_component(*this);
else
- dparent->add_child(*this);
+ parent->add_child(*this);
}
template<typename T>