template<typename TComponent> inline void addComponent(TEntityId id, TComponent component) { auto componentName = GetNameOfComponent<TComponent>(); componentEntityMap.insert(std::make_pair(componentName, id)); entityComponentMap[id].insert(std::make_pair(componentName, MakeComponentPtr(component))); }
void AddComponent(T* c) { static_assert(std::is_base_of<Component, T>::value, "AddComponent needs a subclass of Component"); componentMap.insert({&typeid(T), MakeComponentPtr(c)}); }
void AddComponent(Args&&... args) { static_assert(std::is_base_of<Component, T>::value, "AddComponent needs a subclass of Component"); auto component = MakeComponentPtr(new T(std::forward<Args>(args)...)); componentMap.insert({&typeid(T), std::move(component)}); }