Sdk: Components no longer need to be default-constructibles

Former-commit-id: 7fffb2029784fc5361e560e3568d4c739f433a91 [formerly 14435fa68c516f1d16b2c474bef81f9a465cd7be]
Former-commit-id: 8a14c5defaabc15e92ef8e2854de5598683e27ac
This commit is contained in:
Lynix 2016-07-30 15:50:02 +02:00
parent 2b8032debb
commit f60ce60cd5
1 changed files with 2 additions and 4 deletions

View File

@ -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);