Sdk: Components no longer need to be default-constructibles
Former-commit-id: 995fb3dc8acff9b298603740812e9f689d800162 [formerly d67c4d851d711a0c26dd0967a9bcfa6bf5564061] Former-commit-id: bb864925dcb9541615c6bac341a851ddffd75ac5
This commit is contained in:
parent
0cf5a12067
commit
e950118263
|
|
@ -28,13 +28,11 @@ namespace Ndk
|
||||||
template<typename ComponentType>
|
template<typename ComponentType>
|
||||||
ComponentIndex Component<ComponentType>::RegisterComponent(ComponentId id)
|
ComponentIndex Component<ComponentType>::RegisterComponent(ComponentId id)
|
||||||
{
|
{
|
||||||
// Il faut que notre composant possède un constructeur par défaut (pour la factory)
|
|
||||||
static_assert(std::is_default_constructible<ComponentType>::value, "ComponentType must be default-constructible");
|
|
||||||
|
|
||||||
// On utilise les lambda pour créer une fonction factory
|
// On utilise les lambda pour créer une fonction factory
|
||||||
auto factory = []() -> BaseComponent*
|
auto factory = []() -> BaseComponent*
|
||||||
{
|
{
|
||||||
return new ComponentType;
|
return nullptr; //< Temporary workaround to allow non-default-constructed components, will be updated for serialization
|
||||||
|
//return new ComponentType;
|
||||||
};
|
};
|
||||||
|
|
||||||
return BaseComponent::RegisterComponent(id, factory);
|
return BaseComponent::RegisterComponent(id, factory);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue