Sdk: Components no longer need to be default-constructibles
Former-commit-id: 7fffb2029784fc5361e560e3568d4c739f433a91 [formerly 14435fa68c516f1d16b2c474bef81f9a465cd7be] Former-commit-id: 8a14c5defaabc15e92ef8e2854de5598683e27ac
This commit is contained in:
parent
2b8032debb
commit
f60ce60cd5
|
|
@ -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