23 #include <unordered_map>
37 struct TestMarkFactory::Impl {
38 std::unordered_map<std::string, std::function<
TestMarkPtr()>> ctors;
42 const Impl&) =
delete;
44 const Impl&) =
delete;
50 TestMarkFactory::Impl::Impl() {
54 TestMarkFactory::Impl::~Impl() {
58 void TestMarkFactory::doRegisterRecord(
59 const std::string& typemark_,
61 auto result_(pimpl->ctors.insert({typemark_, ctor_}));
62 assert(result_.second);
69 registerMark<TestMarkNull>();
70 registerMark<TestMarkBool>();
71 registerMark<TestMarkInt>();
72 registerMark<TestMarkFloat>();
73 registerMark<TestMarkString>();
74 registerMark<TestMarkList>();
75 registerMark<TestMarkMap>();
83 const std::string& typemark_) {
84 auto iter_(pimpl->ctors.find(typemark_));
85 if(iter_ == pimpl->ctors.end())
87 return (*iter_).second();