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