diff --git a/fairmq/sdk/Topology.h b/fairmq/sdk/Topology.h index 93e993ed..e3f112e6 100644 --- a/fairmq/sdk/Topology.h +++ b/fairmq/sdk/Topology.h @@ -9,6 +9,7 @@ #ifndef FAIR_MQ_SDK_TOPOLOGY_H #define FAIR_MQ_SDK_TOPOLOGY_H +#include #include #include #include @@ -450,12 +451,9 @@ class BasicTopology : public AsioBase /// 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!