Sdk: Components no longer need to be default-constructibles
Former-commit-id: 71a7ec05389b77844b17effed45d415cbde2923f [formerly cb3cec5cdcf1aa7d8caff80d8de9b6ec61e5d82d] Former-commit-id: dd47985855712c5906b5bf051673714fff51b20c
This commit is contained in:
parent
ab89c2e7e9
commit
6890dc1c81
|
|
@ -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