From 4032199c07a2755313b34d4273b8ca4d35c8f040 Mon Sep 17 00:00:00 2001 From: revol-xut Date: Mon, 21 Aug 2023 15:45:09 +0200 Subject: [PATCH] making clang tidy happy --- lib/environment.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/environment.cc b/lib/environment.cc index 4c9ce621..1e2db871 100644 --- a/lib/environment.cc +++ b/lib/environment.cc @@ -24,6 +24,16 @@ namespace reactor { +void vector_shuffle(std::vector>& path, BasePort* source) { + for (auto it = std::begin(path); it != std::end(path); ++it) { + if (std::next(it) == std::end(path)) { + it->second = source; + } else { + it->second = std::next(it)->second; + } + } +}; + Environment::Environment(unsigned int num_workers, bool fast_fwd_execution, const Duration& timeout) : log_("Environment") , num_workers_(num_workers) @@ -155,13 +165,7 @@ void Environment::expand_and_merge() { std::reverse(path.begin(), path.end()); auto* previous_element = std::begin(path)->second; - for (auto it = std::begin(path); it != std::end(path); ++it) { - if (std::next(it) == std::end(path)) { - it->second = source; - } else { - it->second = std::next(it)->second; - } - } + shuffle(path, source); auto current_rating = previous_element->rating();