16 #ifndef OPENSCENARIO_INTERPRETER__UTILITY__CIRCULAR_CHECK_HPP_
17 #define OPENSCENARIO_INTERPRETER__UTILITY__CIRCULAR_CHECK_HPP_
19 #include <unordered_map>
24 inline namespace utility
28 template <
class Node,
class NodeToChildren,
class NodeToBool>
29 bool circular_check(
const Node & node, NodeToChildren && node_to_children, NodeToBool & visit_flag)
31 if (visit_flag[node]) {
35 visit_flag[node] =
true;
37 for (
auto && child : node_to_children(node)) {
38 if (child == node)
continue;
43 visit_flag[child] =
false;
50 template <
class Node,
class NodeToChildren,
class Hash = std::hash<Node>>
53 std::unordered_map<Node, bool, Hash> visit_flag;
bool circular_check(const Node &node, NodeToChildren &&node_to_children, NodeToBool &visit_flag)
Definition: circular_check.hpp:29
bool circular_check(const Node &init, NodeToChildren &&node_to_children)
Definition: circular_check.hpp:51
Definition: escape_sequence.hpp:22