#pragma once #include #include namespace meta { template class erased_visitor; /* template struct test {}; template struct test, ExtraParams...> : std::function, test,ExtraParams...> { using FunctorStorage = std::shared_ptr; using base2 = test, ExtraParams...>; template, erased_visitor>> > erased_visitor(Visitor && functor) : std::shared_ptr{ std::make_shared(std::forward(functor)) } , std::function { std::reference_wrapper(*static_cast(static_cast(*this).get())) } , base2{std::forward(functor)} { } template, erased_visitor>> > erased_visitor(const Visitor & functor) : std::shared_ptr{ std::make_shared(functor) } , std::function { std::reference_wrapper(*static_cast(static_cast(*this).get())) } ... { } using std::function::operator()...; }; */ template struct Inheritor : T... { template Inheritor(Args&& ... args) : T{args}... { } using T::operator()...; }; template class erased_visitor : std::shared_ptr, Inheritor< std::function...>//, std::function... { public: using FunctorStorage = std::shared_ptr; using base_t =Inheritor< std::function...>; template, erased_visitor>> > erased_visitor(Visitor&& functor) : std::shared_ptr{ std::make_shared(std::forward(functor)) } , base_t{ std::function { std::reference_wrapper(*static_cast(static_cast(*this).get())) } ... } { } template, erased_visitor>> > erased_visitor(const Visitor& functor) : std::shared_ptr{std::make_shared(functor)} , base_t{ std::function { std::reference_wrapper(*static_cast(static_cast(*this).get())) } ... } { } //template //using func_t = Rets(OverloadedParam, ExtraParams...); //template //using func2_t = std::function>; //using func2_t::operator()...; using base_t::operator()...; }; }