perf: avoid copies in range-based for loops

- take loop variables by const reference where the body does not modify
  them
- clang-tidy performance-for-range-copy
  https://clang.llvm.org/extra/clang-tidy/checks/performance/for-range-copy.html
This commit is contained in:
Dennis Klein
2026-06-09 19:59:32 +02:00
committed by Dennis Klein
parent 7a44c5e19e
commit 0feda158b4
3 changed files with 4 additions and 4 deletions

View File

@@ -86,7 +86,7 @@ class Poller final : public fair::mq::Poller
fItems = new zmq_pollitem_t[fNumItems];
int index = 0;
for (std::string channel : channelList) {
for (const std::string& channel : channelList) {
for (unsigned int i = 0; i < channelsMap.at(channel).size(); ++i) {
index = fOffsetMap[channel] + i;