/** Ensure at least one transition is marked as todo among the enabled ones not done.
* If required, it marks as todo the best transition according to the strategy. */
void consider_best() {
- for (auto& [_, actor] :actors_to_run_)
- if (actor.is_todo())
- return;
+ if (std::any_of(begin(actors_to_run_), end(actors_to_run_),
+ [](const auto& actor) { return actor.second.is_todo(); }))
+ return;
aid_t best_aid = best_transition(false).first;
if (best_aid != -1)
actors_to_run_.at(best_aid).mark_todo();
Transition* get_current_transition() const { return transitions_.at(times_considered_); }
bool result() const
{
- for (Transition* transition : transitions_) {
- CommTestTransition* tested_transition = static_cast<CommTestTransition*>(transition);
- if (tested_transition->get_sender() != -1 and tested_transition->get_receiver() != -1)
- return true;
- }
- return false;
+ return std::any_of(begin(transitions_), end(transitions_), [](const Transition* transition) {
+ const auto* tested_transition = static_cast<const CommTestTransition*>(transition);
+ return (tested_transition->get_sender() != -1 && tested_transition->get_receiver() != -1);
+ });
}
};