#pragma once #include #include #include #include #include namespace flow::dsl { template concept subgraph = requires { typename stdx::remove_cvref_t::is_subgraph; }; template struct edge { using source_t = Source; using dest_t = Dest; using cond_t = Cond; }; constexpr inline class get_initials_t { template friend constexpr auto tag_invoke(get_initials_t, N &&n) { return stdx::make_tuple(std::forward(n)); } public: template constexpr auto operator()(Ts &&...ts) const noexcept(noexcept(tag_invoke(std::declval(), std::forward(ts)...))) -> decltype(tag_invoke(*this, std::forward(ts)...)) { return tag_invoke(*this, std::forward(ts)...); } } get_initials{}; constexpr inline class get_finals_t { template friend constexpr auto tag_invoke(get_finals_t, N &&n) { return stdx::make_tuple(std::forward(n)); } public: template constexpr auto operator()(Ts &&...ts) const noexcept(noexcept(tag_invoke(std::declval(), std::forward(ts)...))) -> decltype(tag_invoke(*this, std::forward(ts)...)) { return tag_invoke(*this, std::forward(ts)...); } } get_finals{}; constexpr inline class get_nodes_t { template friend constexpr auto tag_invoke(get_nodes_t, N &&n) { if constexpr (std::remove_cvref_t::identity == subgraph_identity::REFERENCE) { return stdx::tuple{}; } else { return stdx::make_tuple(std::forward(n)); } } public: template constexpr auto operator()(Ts &&...ts) const noexcept(noexcept(tag_invoke(std::declval(), std::forward(ts)...))) -> decltype(tag_invoke(*this, std::forward(ts)...)) { return tag_invoke(*this, std::forward(ts)...); } } get_nodes{}; constexpr inline class get_all_mentioned_nodes_t { template friend constexpr auto tag_invoke(get_all_mentioned_nodes_t, N &&n) { return stdx::make_tuple(std::forward(n)); } public: template constexpr auto operator()(Ts &&...ts) const noexcept(noexcept(tag_invoke(std::declval(), std::forward(ts)...))) -> decltype(tag_invoke(*this, std::forward(ts)...)) { return tag_invoke(*this, std::forward(ts)...); } } get_all_mentioned_nodes{}; constexpr inline class get_edges_t { friend constexpr auto tag_invoke(get_edges_t, subgraph auto const &) { return stdx::tuple{}; } public: template constexpr auto operator()(Ts &&...ts) const noexcept(noexcept(tag_invoke(std::declval(), std::forward(ts)...))) -> decltype(tag_invoke(*this, std::forward(ts)...)) { return tag_invoke(*this, std::forward(ts)...); } } get_edges{}; } // namespace flow::dsl