From 6cdb8b0ffdaa9a19793b9c22195fa77487fc8d36 Mon Sep 17 00:00:00 2001 From: sha512sum Date: Tue, 11 Jun 2024 08:38:57 +0000 Subject: [PATCH] Fix --- include/cserver/engine/components.hpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) 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<> {