Support creating ecs index without passing the container
This commit is contained in:
parent
8fcaef4ba1
commit
46a49ef42d
1 changed files with 6 additions and 0 deletions
|
|
@ -32,6 +32,12 @@ namespace psemek::ecs::detail
|
|||
storage_.insert({uuid, ptr});
|
||||
return *ptr;
|
||||
}
|
||||
else if constexpr (std::is_constructible_v<Index, Args && ...>)
|
||||
{
|
||||
auto ptr = std::make_shared<Index>(std::forward<Args>(args)...);
|
||||
storage_.insert({uuid, ptr});
|
||||
return *ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw util::exception("Index " + util::type_name<Index>() + " is neither present nor constructible");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue