From 8e23c9f67c8aa4590d12716d4b6859af4db12f1a Mon Sep 17 00:00:00 2001 From: Julien Esseiva Date: Wed, 18 Sep 2024 17:52:15 -0700 Subject: [PATCH] use get_if --- .../orangeinp/detail/DeMorganSimplifier.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/orange/orangeinp/detail/DeMorganSimplifier.cc b/src/orange/orangeinp/detail/DeMorganSimplifier.cc index da6f1a8872..f6ab7a592a 100644 --- a/src/orange/orangeinp/detail/DeMorganSimplifier.cc +++ b/src/orange/orangeinp/detail/DeMorganSimplifier.cc @@ -135,19 +135,20 @@ void DeMorganSimplifier::find_join_negations() }, [&](Joined const& joined) { handle_joined(node_id, joined); }, [&](Aliased const& aliased) { - auto const& alias_target = tree_[aliased.node]; + auto const* target_node = &tree_[aliased.node]; + CELER_EXPECT( + !std::holds_alternative(*target_node)); // treat the aliased node as its target - if (std::holds_alternative(alias_target)) + if (Negated const* negated + = std::get_if(target_node)) { - handle_negated(node_id, - std::get(alias_target)); + handle_negated(node_id, *negated); } - else if (std::holds_alternative(alias_target)) + else if (Joined const* joined + = std::get_if(target_node)) { - handle_joined(node_id, std::get(alias_target)); + handle_joined(node_id, *joined); } - CELER_EXPECT( - !std::holds_alternative(alias_target)); }, // Nothing to do for leaf node types [](auto&&) {},