factory.hpp (442B)
1 #ifndef UUID_F3B9AB07_80DA_4DCF_AA4F_F6E225EFA110 2 #define UUID_F3B9AB07_80DA_4DCF_AA4F_F6E225EFA110 3 #pragma once 4 5 #include <vector> 6 7 namespace Neptools 8 { 9 10 template <typename FunT> 11 class BaseFactory 12 { 13 public: 14 using Fun = FunT; 15 BaseFactory(Fun f) { GetStore().push_back(f); } 16 17 protected: 18 using Store = std::vector<Fun>; 19 static Store& GetStore() 20 { 21 static Store store; 22 return store; 23 } 24 }; 25 26 } 27 #endif