diff --git a/include/cserver/engine/components.hpp b/include/cserver/engine/components.hpp index 8bfd936..2ea93f8 100644 --- a/include/cserver/engine/components.hpp +++ b/include/cserver/engine/components.hpp @@ -2,7 +2,6 @@ #include #include #include -#include namespace cserver { @@ -73,14 +72,12 @@ inline constexpr auto GetInitFlagFor(auto&... args) -> InitFlag& { }; template -inline constexpr auto TransformDependencyGraphToInited(auto&&... args) { - return [&](std::index_sequence) { - return utempl::Tuple{[&](utempl::Wrapper){ - return [&](std::index_sequence){ - return std::array{&GetInitFlagFor(args...)...}; - }(std::make_index_sequence()); - }(utempl::Wrapper(Tuple)>{})...}; - }(std::make_index_sequence>()); +constexpr auto TransformDependencyGraphToTupleWithDependenciesToInitedFlagChanges(auto&&... args) { + return utempl::Map(utempl::PackConstexprWrapper(), [&](utempl::Wrapper) { + return utempl::Map(utempl::PackConstexprWrapper>(), [&](auto elem) { + return &GetInitFlagFor(elem)>(args...); + }, utempl::kType>); + }); }; struct AsyncConditionVariable { @@ -124,7 +121,7 @@ inline constexpr auto InitComponents(T& ccontext) -> void { static auto& context = ccontext; static auto& taskProcessor = context.template FindComponent(); static auto& ioContext = taskProcessor.ioContext; - static utempl::Tuple inited = TransformDependencyGraphToInited(ioContext); + static utempl::Tuple inited = TransformDependencyGraphToTupleWithDependenciesToInitedFlagChanges(ioContext); auto work = make_work_guard(ioContext); [](std::index_sequence){ (boost::asio::co_spawn(ioContext, []() -> cserver::Task<> {