9 template <
typename T,
typename... Args>
11 using Maker = std::function< T*(Args&...) >;
13 static auto Makers() -> std::map<std::string, Maker >& {
14 static std::map<std::string, Maker > makers;
19 static auto Register(
const std::string& name) ->
bool {
20 Makers()[name] = [](Args&... args) {
21 return new S(args...);
26 static T* Create(
const std::string& name, Args&... args){
27 auto maker = Makers().find( name );
28 if(maker == Makers().end()){
31 return maker->second(args...);