Skip to content

Commit 64e3612

Browse files
committed
making clang tidy happy
1 parent 044d291 commit 64e3612

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/environment.cc

+11-7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424

2525
namespace reactor {
2626

27+
void vector_shuffle(std::vector<std::pair<ConnectionProperties, BasePort*>>& path, BasePort* source) {
28+
for (auto it = std::begin(path); it != std::end(path); ++it) {
29+
if (std::next(it) == std::end(path)) {
30+
it->second = source;
31+
} else {
32+
it->second = std::next(it)->second;
33+
}
34+
}
35+
};
36+
2737
Environment::Environment(unsigned int num_workers, bool fast_fwd_execution, const Duration& timeout)
2838
: log_("Environment")
2939
, num_workers_(num_workers)
@@ -155,13 +165,7 @@ void Environment::expand_and_merge() {
155165
std::reverse(path.begin(), path.end());
156166

157167
auto* previous_element = std::begin(path)->second;
158-
for (auto it = std::begin(path); it != std::end(path); ++it) {
159-
if (std::next(it) == std::end(path)) {
160-
it->second = source;
161-
} else {
162-
it->second = std::next(it)->second;
163-
}
164-
}
168+
vector_shuffle(path, source);
165169

166170
auto current_rating = previous_element->rating();
167171

0 commit comments

Comments
 (0)