Skip to content

Commit 2368b4c

Browse files
committed
Assert that dependency_kind fulfills the assumed total order
1 parent 5f52839 commit 2368b4c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/intrusive_graph.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ namespace detail {
7171
// Check for (direct) cycles
7272
assert(!has_dependent(dep.node));
7373

74-
auto it = maybe_get_dep(dependencies, dep.node);
75-
if(it != std::nullopt) {
74+
if(const auto it = maybe_get_dep(dependencies, dep.node)) {
75+
// We assume that for dependency kinds A and B, max(A, B) is strong enough to satisfy both.
76+
static_assert(dependency_kind::ANTI_DEP < dependency_kind::ORDER_DEP && dependency_kind::ORDER_DEP < dependency_kind::TRUE_DEP);
77+
7678
// Already exists, potentially upgrade to full dependency
7779
if((*it)->kind < dep.kind) {
7880
(*it)->kind = dep.kind;

0 commit comments

Comments
 (0)