Stupid circular dependency fixed.

This commit is contained in:
2014-02-25 20:09:15 +01:00
parent 369ff782f1
commit 63337cf660
4 changed files with 17 additions and 8 deletions
+3 -2
View File
@@ -2,10 +2,11 @@
#define ComponentFactory_h__
#include <string>
#include <memory>
#include <functional>
#include <map>
#include "Component.h"
struct Component;
#define REGISTER_COMPONENT(NAME, TYPE) \
static ComponentRegistrar<TYPE> registrar(NAME);
@@ -16,7 +17,7 @@ class ComponentRegistrar
public:
ComponentRegistrar(std::string name)
{
ComponentFactory::Instance()->Register(name, [](void) -> std::shared_ptr<Component> { return new T() });
ComponentFactory::Instance()->Register(name, [](void) -> std::shared_ptr<Component> { return std::shared_ptr<Component>(new T()); });
}
};