From 8fc0ac10aec50f4d84c3f520e82f3a624f59d12e Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Mon, 18 Jan 2021 13:23:11 +0100 Subject: [PATCH] Fix compiler warnings Use reference in for loop too avoid copying of data. --- MQ/source/CbmMQTsaMultiSampler.cxx | 2 +- MQ/source/CbmMQTsaMultiSamplerTof.cxx | 2 +- sim/transport/geosetup/CbmGeoSetupRepoProvider.cxx | 2 +- tutorials/TaskToAlgo/CbmStsHitProducerIdealWrapper.cxx | 2 +- tutorials/TaskToAlgo/CbmStsHitProducerTaskIdeal.cxx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MQ/source/CbmMQTsaMultiSampler.cxx b/MQ/source/CbmMQTsaMultiSampler.cxx index e1d0440a38..ff968c8b73 100644 --- a/MQ/source/CbmMQTsaMultiSampler.cxx +++ b/MQ/source/CbmMQTsaMultiSampler.cxx @@ -230,7 +230,7 @@ void CbmMQTsaMultiSampler::InitTask() try { } else { // Create a ";" separated string with all file names std::string fileList {""}; - for (const auto obj : fInputFileList) { + for (const auto& obj : fInputFileList) { std::string fileName = obj; fileList += fileName; fileList += ";"; diff --git a/MQ/source/CbmMQTsaMultiSamplerTof.cxx b/MQ/source/CbmMQTsaMultiSamplerTof.cxx index c9ade75215..82de7085e0 100644 --- a/MQ/source/CbmMQTsaMultiSamplerTof.cxx +++ b/MQ/source/CbmMQTsaMultiSamplerTof.cxx @@ -151,7 +151,7 @@ void CbmMQTsaMultiSamplerTof::InitTask() try { } else { // Create a ";" separated string with all file names std::string fileList {""}; - for (const auto obj : fInputFileList) { + for (const auto& obj : fInputFileList) { std::string fileName = obj; fileList += fileName; fileList += ";"; diff --git a/sim/transport/geosetup/CbmGeoSetupRepoProvider.cxx b/sim/transport/geosetup/CbmGeoSetupRepoProvider.cxx index 405e017f7f..d1f8093d99 100644 --- a/sim/transport/geosetup/CbmGeoSetupRepoProvider.cxx +++ b/sim/transport/geosetup/CbmGeoSetupRepoProvider.cxx @@ -78,7 +78,7 @@ namespace { //anonymous namespace with helpers std::regex setupRegex(searchPattern); std::smatch match; std::vector<std::string> result; - for (const auto& file : *fileList) { + for (const auto&& file : *fileList) { std::string fileName = file->GetName(); if (std::regex_search(fileName, match, setupRegex)) diff --git a/tutorials/TaskToAlgo/CbmStsHitProducerIdealWrapper.cxx b/tutorials/TaskToAlgo/CbmStsHitProducerIdealWrapper.cxx index 81a4024172..253c565e1f 100644 --- a/tutorials/TaskToAlgo/CbmStsHitProducerIdealWrapper.cxx +++ b/tutorials/TaskToAlgo/CbmStsHitProducerIdealWrapper.cxx @@ -124,7 +124,7 @@ void CbmStsHitProducerIdealWrapper::Exec(Option_t* /*opt*/) { // Fill the content of vector into TCA int iPoint = 0; - for (auto const hit : hits) { + for (const auto& hit : hits) { new ((*fHitArray)[iPoint]) CbmStsHit(hit); iPoint++; } diff --git a/tutorials/TaskToAlgo/CbmStsHitProducerTaskIdeal.cxx b/tutorials/TaskToAlgo/CbmStsHitProducerTaskIdeal.cxx index 272244b6dc..4ab4334909 100644 --- a/tutorials/TaskToAlgo/CbmStsHitProducerTaskIdeal.cxx +++ b/tutorials/TaskToAlgo/CbmStsHitProducerTaskIdeal.cxx @@ -148,7 +148,7 @@ void CbmStsHitProducerTaskIdeal::Exec(Option_t* /*opt*/) { // Fill the content of vector into TCA int iPoint = 0; - for (auto const hit : hits) { + for (const auto& hit : hits) { new ((*fHitArray)[iPoint]) CbmStsHit(hit); iPoint++; } -- GitLab