From 904cb203875757e210e3f826e6799787de99f69c Mon Sep 17 00:00:00 2001 From: sha512sum Date: Tue, 26 Mar 2024 09:11:05 +0000 Subject: [PATCH] Use Map instead directly using --- include/cserver/engine/components.hpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/include/cserver/engine/components.hpp b/include/cserver/engine/components.hpp index 26a4a51..8236930 100644 --- a/include/cserver/engine/components.hpp +++ b/include/cserver/engine/components.hpp @@ -274,15 +274,19 @@ RangeView(std::ranges::range auto&& range) -> RangeView consteval auto TopologicalSort(const DependencyGraph...>&) { - const utempl::Tuple storage = {[&](utempl::Wrapper) { - return [&](std::index_sequence) -> std::array> { - return {utempl::Find(utempl::Tuple{Names...}, Get(DDependencies))...}; - }(std::make_index_sequence>{}); - }(utempl::Wrapper{})...}; + constexpr utempl::Tuple names = {Names...}; + constexpr utempl::Tuple storage = Map(utempl::Tuple{Dependencies...}, + [&](Tuple&& tuple){ + static constexpr auto Size = utempl::kTupleSize; + return [&](std::index_sequence) -> std::array { + return {Find(names, Get(std::forward(tuple)))...}; + }(std::make_index_sequence()); + }); constexpr auto Size = utempl::kTupleSize; - const std::array adj = [&](std::index_sequence){ - return std::array{impl::RangeView{Get(storage)}...}; - }(std::make_index_sequence{}); + const std::array adj = utempl::Map(storage, + [](std::ranges::range auto& arg){ + return impl::RangeView{arg}; + }, utempl::kType>); std::array visited{}; constexpr auto ResultSize = sizeof...(Dependencies); impl::CompileTimeStack response{}; @@ -300,7 +304,7 @@ consteval auto TopologicalSort(const DependencyGraph