_Pragma("once") #include "tinyengine/pch.hpp" #include "tinyengine/pool.hpp" using ComponentId = unsigned int; class Component { public: friend class Pool; virtual ~Component() = default; inline bool IsAlive() const { return alive_; } virtual void Release() = 0; private: bool alive_; }; class ComponentIdx final { public: template static ComponentId Get() { static_assert(std::is_base_of_v && !std::is_same_v); static ComponentId id = count_ ++; return id; } inline static ComponentId GetCount() { return count_; } private: static ComponentId count_; }; struct ComponentPool{ }; extern std::unordered_map> gComponentPool;