From: Arnaud Giersch Date: Tue, 9 Aug 2022 20:39:20 +0000 (+0200) Subject: Fix the fixme (inline templated struct). X-Git-Tag: v3.32~61 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7f626fa7e7d9a7d28fdc994ae197f82f0a0c6e52 Fix the fixme (inline templated struct). --- diff --git a/src/mc/VisitedState.cpp b/src/mc/VisitedState.cpp index 74c7147b1d..8264c2a6e4 100644 --- a/src/mc/VisitedState.cpp +++ b/src/mc/VisitedState.cpp @@ -47,8 +47,9 @@ std::unique_ptr VisitedStates::addVisitedState(unsign XBT_DEBUG("Snapshot %p of visited state %ld (exploration stack state %ld)", new_state->system_state.get(), new_state->num, graph_state->get_num()); - auto [range_begin, range_end] = - boost::range::equal_range(states_, new_state.get(), compare_pair_by_actor_count_and_used_heap()); + auto [range_begin, range_end] = boost::range::equal_range(states_, new_state.get(), [](auto const& a, auto const& b) { + return std::make_pair(a->actor_count_, a->heap_bytes_used) < std::make_pair(b->actor_count_, b->heap_bytes_used); + }); for (auto i = range_begin; i != range_end; ++i) { auto& visited_state = *i; diff --git a/src/mc/explo/Exploration.hpp b/src/mc/explo/Exploration.hpp index ee5471c596..9dfebd25f4 100644 --- a/src/mc/explo/Exploration.hpp +++ b/src/mc/explo/Exploration.hpp @@ -66,18 +66,6 @@ XBT_PUBLIC Exploration* create_dfs_exploration(const std::vector& args, b XBT_PUBLIC Exploration* create_communication_determinism_checker(const std::vector& args, bool with_dpor); XBT_PUBLIC Exploration* create_udpor_checker(const std::vector& args); -// FIXME: kill this template and use lambdas in boost::range_equal -struct DerefAndCompareByActorsCountAndUsedHeap { - template bool operator()(X const& a, Y const& b) const - { - return std::make_pair(a->actor_count_, a->heap_bytes_used) < std::make_pair(b->actor_count_, b->heap_bytes_used); - } -}; -static inline DerefAndCompareByActorsCountAndUsedHeap compare_pair_by_actor_count_and_used_heap() -{ - return DerefAndCompareByActorsCountAndUsedHeap(); -} - } // namespace simgrid::mc #endif diff --git a/src/mc/explo/LivenessChecker.cpp b/src/mc/explo/LivenessChecker.cpp index ab212dca6e..26fb2a8de3 100644 --- a/src/mc/explo/LivenessChecker.cpp +++ b/src/mc/explo/LivenessChecker.cpp @@ -62,8 +62,10 @@ std::shared_ptr LivenessChecker::insert_acceptance_pair(simgrid::mc auto new_pair = std::make_shared(pair->num, pair->prop_state_, pair->atomic_propositions, pair->app_state_); - auto [res_begin, res_end] = - boost::range::equal_range(acceptance_pairs_, new_pair.get(), compare_pair_by_actor_count_and_used_heap()); + auto [res_begin, + res_end] = boost::range::equal_range(acceptance_pairs_, new_pair.get(), [](auto const& a, auto const& b) { + return std::make_pair(a->actor_count_, a->heap_bytes_used) < std::make_pair(b->actor_count_, b->heap_bytes_used); + }); if (pair->search_cycle) for (auto i = res_begin; i != res_end; ++i) { @@ -139,8 +141,10 @@ int LivenessChecker::insert_visited_pair(std::shared_ptr visited_pa visited_pair = std::make_shared(pair->num, pair->prop_state_, pair->atomic_propositions, pair->app_state_); - auto [range_begin, range_end] = - boost::range::equal_range(visited_pairs_, visited_pair.get(), compare_pair_by_actor_count_and_used_heap()); + auto [range_begin, + range_end] = boost::range::equal_range(visited_pairs_, visited_pair.get(), [](auto const& a, auto const& b) { + return std::make_pair(a->actor_count_, a->heap_bytes_used) < std::make_pair(b->actor_count_, b->heap_bytes_used); + }); for (auto i = range_begin; i != range_end; ++i) { const VisitedPair* pair_test = i->get();