(Component) Fixed Clone method

Former-commit-id: afa38a9b684f045dc3cf0d072736ebb6c47e4bd7
This commit is contained in:
Lynix 2015-03-01 13:41:44 +01:00
parent 99bf3d95f7
commit 7c73407fa4
2 changed files with 6 additions and 6 deletions

View File

@ -19,11 +19,10 @@ namespace Ndk
Component(); Component();
virtual ~Component(); virtual ~Component();
virtual BaseComponent* Clone() const override; BaseComponent* Clone() const override;
}; };
template<typename ComponentType> template<typename ComponentType> constexpr nzUInt32 GetComponentId();
constexpr nzUInt32 GetComponentId();
} }
#include <NDK/Component.inl> #include <NDK/Component.inl>

View File

@ -16,11 +16,12 @@ namespace Ndk
Component<ComponentType>::~Component() = default; Component<ComponentType>::~Component() = default;
template<typename ComponentType> template<typename ComponentType>
virtual BaseComponent* Component<ComponentType>::Clone() const BaseComponent* Component<ComponentType>::Clone() const
{ {
static_assert<std::is_trivially_copy_constructible<ComponentType>::value, "ComponentType should be copy-constructible"> ///FIXME: Pas encore supporté par GCC (4.9.2)
//static_assert(std::is_trivially_copy_constructible<ComponentType>::value, "ComponentType should be copy-constructible");
return new ComponentType(static_cast<ComponentType&>(*this)); return new ComponentType(static_cast<const ComponentType&>(*this));
} }
template<typename ComponentType> template<typename ComponentType>