mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
SDK: Replace for loop with count_if
This commit is contained in:
parent
23423a86d9
commit
47d9e282d4
|
@ -9,6 +9,7 @@
|
|||
#ifndef FAIR_MQ_SDK_TOPOLOGY_H
|
||||
#define FAIR_MQ_SDK_TOPOLOGY_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <asio/async_result.hpp>
|
||||
#include <asio/associated_executor.hpp>
|
||||
#include <asio/steady_timer.hpp>
|
||||
|
@ -450,12 +451,9 @@ class BasicTopology : public AsioBase<Executor, Allocator>
|
|||
/// call only under locked fMtx!
|
||||
auto ResetTransitionedCount(DeviceState targetState) -> void
|
||||
{
|
||||
fTransitionedCount = 0;
|
||||
for (const auto& s : fState) {
|
||||
if (s.second.state == targetState) {
|
||||
++fTransitionedCount;
|
||||
}
|
||||
}
|
||||
fTransitionedCount = std::count_if(fState.cbegin(), fState.cend(), [=](const auto& s) {
|
||||
return s.second.state == targetState;
|
||||
});
|
||||
}
|
||||
|
||||
/// call only under locked fMtx!
|
||||
|
|
Loading…
Reference in New Issue
Block a user