#include "persistance.h" #include namespace Persistanace { using NamedTypeFactories = std::map()>>; static NamedTypeFactories namedTypeFactories; void Persistable::addFactory(const std::string_view t, std::function()> f) { namedTypeFactories.emplace(t, std::move(f)); } std::unique_ptr Persistable::callFactory(const std::string_view t) { return namedTypeFactories.at(t)(); } void Selection::operator()(float &) { throw std::runtime_error("Unexpected float"); } void Selection::operator()(bool &) { throw std::runtime_error("Unexpected bool"); } void Selection::operator()(const std::nullptr_t &) { throw std::runtime_error("Unexpected null"); } void Selection::operator()(std::string &) { throw std::runtime_error("Unexpected string"); } void Selection::BeginArray(Stack &) { throw std::runtime_error("Unexpected array"); } void Selection::BeginObject(Stack &) { throw std::runtime_error("Unexpected object"); } void Selection::beforeValue(Stack &) { throw std::runtime_error("Unexpected value"); } SelectionPtr Selection::select(const std::string &) { throw std::runtime_error("Unexpected select"); } void Selection::EndObject(Stack &) { } static_assert(!SelectionT::ArrayLike); static_assert(!SelectionT::ArrayLike); static_assert(!SelectionT::ArrayLike); static_assert(SelectionT>::ArrayLike); static_assert(SelectionT::ArrayLike); static_assert(SelectionT>::ArrayLike); }