diff --git a/Core/include/Acts/Utilities/BoundingBox.ipp b/Core/include/Acts/Utilities/BoundingBox.ipp index 330353014fa..d989507fa85 100644 --- a/Core/include/Acts/Utilities/BoundingBox.ipp +++ b/Core/include/Acts/Utilities/BoundingBox.ipp @@ -346,8 +346,7 @@ template Acts::AxisAlignedBoundingBox Acts::AxisAlignedBoundingBox::transformed( const transform_type& trf) const { - VertexType vmin, vmax; - std::tie(vmin, vmax) = transformVertices(trf); + const auto [vmin, vmax] = transformVertices(trf); return self_t(m_entity, vmin, vmax); } @@ -463,8 +462,7 @@ box_t* octree_inner(std::vector>& store, std::array, 8> octants; // calc center of boxes - VertexType vmin, vmax; - std::tie(vmin, vmax) = box_t::wrap(lprims); + const auto [vmin, vmax] = box_t::wrap(lprims); VertexType glob_ctr = (vmin + vmax) / 2.; for (auto* box : lprims) { diff --git a/Core/include/Acts/Utilities/GridAxisGenerators.hpp b/Core/include/Acts/Utilities/GridAxisGenerators.hpp index 2ebeb78406f..18e6a1cdd2e 100644 --- a/Core/include/Acts/Utilities/GridAxisGenerators.hpp +++ b/Core/include/Acts/Utilities/GridAxisGenerators.hpp @@ -110,7 +110,7 @@ struct EqEq { nBins0); Acts::Axis bEq(range1[0u], range1[1u], nBins1); - return std::tie(aEq, bEq); + return {aEq, bEq}; } }; @@ -160,7 +160,7 @@ struct EqVar { Acts::Axis eqA(range[0u], range[1u], nBins); Acts::Axis varB(edges); - return std::tie(eqA, varB); + return {eqA, varB}; } }; @@ -210,7 +210,7 @@ struct VarEq { Acts::Axis varA(edges); Acts::Axis eqB(range[0u], range[1u], nBins); - return std::tie(varA, eqB); + return {varA, eqB}; } }; @@ -257,7 +257,7 @@ struct VarVar { return_type operator()() const { Acts::Axis varA(edges0); Acts::Axis varB(edges1); - return std::tie(varA, varB); + return {varA, varB}; } }; diff --git a/Core/include/Acts/Utilities/Helpers.hpp b/Core/include/Acts/Utilities/Helpers.hpp index 2308d2a3014..4bf9d1c89c3 100644 --- a/Core/include/Acts/Utilities/Helpers.hpp +++ b/Core/include/Acts/Utilities/Helpers.hpp @@ -179,7 +179,7 @@ std::tuple range_medium(const T& tseries) { auto [minIt, maxIt] = std::ranges::minmax_element(tseries); typename T::value_type range = (*maxIt - *minIt); ActsScalar medium = static_cast((*maxIt + *minIt) * 0.5); - return std::tie(range, medium); + return {range, medium}; } template diff --git a/Core/include/Acts/Vertexing/detail/KalmanVertexUpdaterImpl.hpp b/Core/include/Acts/Vertexing/detail/KalmanVertexUpdaterImpl.hpp index 4c08820e693..f8f99b98f20 100644 --- a/Core/include/Acts/Vertexing/detail/KalmanVertexUpdaterImpl.hpp +++ b/Core/include/Acts/Vertexing/detail/KalmanVertexUpdaterImpl.hpp @@ -254,9 +254,7 @@ void updateVertexWithTrackImpl(Vertex& vtx, TrackAtVertex& trk, int sign) { calculateUpdate(vtx, trk.linearizedState, trackWeight, sign, cache); // Get fit quality parameters wrt to old vertex - double chi2 = 0.; - double ndf = 0.; - std::tie(chi2, ndf) = vtx.fitQuality(); + auto [chi2, ndf] = vtx.fitQuality(); // Chi2 of the track parameters double trkChi2 = trackParametersChi2(trk.linearizedState, cache); diff --git a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp index 114b8512e7f..ac2acd2482a 100644 --- a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp @@ -373,7 +373,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::xyzBoundaries( } for (auto [im, map] : enumerate(valueMaps)) { - for (auto [key, value] : map) { + for (auto [key, _] : map) { boundaries[im].push_back(key); } std::ranges::sort(boundaries[im]); diff --git a/Core/src/MagneticField/BFieldMapUtils.cpp b/Core/src/MagneticField/BFieldMapUtils.cpp index 14bc273966b..e7216aa3bf9 100644 --- a/Core/src/MagneticField/BFieldMapUtils.cpp +++ b/Core/src/MagneticField/BFieldMapUtils.cpp @@ -254,12 +254,9 @@ Acts::solenoidFieldMap(std::pair rlim, std::pair zlim, std::pair nbins, const SolenoidBField& field) { - double rMin = 0, rMax = 0, zMin = 0, zMax = 0; - std::tie(rMin, rMax) = rlim; - std::tie(zMin, zMax) = zlim; - - std::size_t nBinsR = 0, nBinsZ = 0; - std::tie(nBinsR, nBinsZ) = nbins; + auto [rMin, rMax] = rlim; + auto [zMin, zMax] = zlim; + const auto [nBinsR, nBinsZ] = nbins; double stepZ = std::abs(zMax - zMin) / (nBinsZ - 1); double stepR = std::abs(rMax - rMin) / (nBinsR - 1); diff --git a/Core/src/Material/BinnedSurfaceMaterialAccumulater.cpp b/Core/src/Material/BinnedSurfaceMaterialAccumulater.cpp index ca2a460d4d2..a4d2366b743 100644 --- a/Core/src/Material/BinnedSurfaceMaterialAccumulater.cpp +++ b/Core/src/Material/BinnedSurfaceMaterialAccumulater.cpp @@ -119,9 +119,9 @@ void Acts::BinnedSurfaceMaterialAccumulater::accumulate( } // After mapping this track, average the touched bins - for (auto tmapBin : touchedMapBins) { - std::vector> trackBins = {tmapBin.second}; - tmapBin.first->trackAverage(trackBins, true); + for (const auto& [key, value] : touchedMapBins) { + std::vector> trackBins = {value}; + key->trackAverage(trackBins, true); } // Empty bin correction diff --git a/Core/src/Material/SurfaceMaterialMapper.cpp b/Core/src/Material/SurfaceMaterialMapper.cpp index 4890354217a..f4ad7ecc6f9 100644 --- a/Core/src/Material/SurfaceMaterialMapper.cpp +++ b/Core/src/Material/SurfaceMaterialMapper.cpp @@ -416,19 +416,19 @@ void Acts::SurfaceMaterialMapper::mapInteraction( } // After mapping this track, average the touched bins - for (auto tmapBin : touchedMapBins) { - std::vector> trackBins = {tmapBin.second}; + for (const auto& [key, value] : touchedMapBins) { + std::vector> trackBins = {value}; if (m_cfg.computeVariance) { // This only makes sense for the binned material auto binnedMaterial = dynamic_cast( - touchedMaterialBin[tmapBin.first].get()); + touchedMaterialBin[key].get()); if (binnedMaterial != nullptr) { - tmapBin.first->trackVariance( + key->trackVariance( trackBins, binnedMaterial->fullMaterial()[trackBins[0][1]][trackBins[0][0]]); } } - tmapBin.first->trackAverage(trackBins); + key->trackAverage(trackBins); } // After mapping this track, average the untouched but intersected bins @@ -493,14 +493,14 @@ void Acts::SurfaceMaterialMapper::mapSurfaceInteraction( } // After mapping this track, average the touched bins - for (auto tmapBin : touchedMapBins) { - std::vector> trackBins = {tmapBin.second}; + for (const auto& [key, value] : touchedMapBins) { + std::vector> trackBins = {value}; if (m_cfg.computeVariance) { // This only makes sense for the binned material auto binnedMaterial = dynamic_cast( - touchedMaterialBin[tmapBin.first].get()); + touchedMaterialBin[key].get()); if (binnedMaterial != nullptr) { - tmapBin.first->trackVariance( + key->trackVariance( trackBins, binnedMaterial->fullMaterial()[trackBins[0][1]][trackBins[0][0]], true); @@ -508,6 +508,6 @@ void Acts::SurfaceMaterialMapper::mapSurfaceInteraction( } // No need to do an extra pass for untouched surfaces they would have been // added to the material interaction in the initial mapping - tmapBin.first->trackAverage(trackBins, true); + key->trackAverage(trackBins, true); } } diff --git a/Core/src/TrackFinding/AmbiguityTrackClustering.cpp b/Core/src/TrackFinding/AmbiguityTrackClustering.cpp index ca6b39571af..ff0e95cbb3d 100644 --- a/Core/src/TrackFinding/AmbiguityTrackClustering.cpp +++ b/Core/src/TrackFinding/AmbiguityTrackClustering.cpp @@ -22,26 +22,26 @@ Acts::detail::clusterDuplicateTracks( std::unordered_map hitToTrack; // Loop over all the tracks - for (auto track = trackMap.rbegin(); track != trackMap.rend(); ++track) { - std::vector hits = track->second.second; + for (const auto& [_, trackValue] : trackMap) { + std::vector hits = trackValue.second; auto matchedTrack = hitToTrack.end(); // Loop over all the hits in the track - for (auto hit = hits.begin(); hit != hits.end(); hit++) { + for (const auto& hit : hits) { // Check if the hit is already associated to a track - matchedTrack = hitToTrack.find(*hit); + matchedTrack = hitToTrack.find(hit); if (matchedTrack != hitToTrack.end()) { // Add the track to the cluster associated to the matched track - cluster.at(matchedTrack->second).push_back(track->second.first); + cluster.at(matchedTrack->second).push_back(trackValue.first); break; } } // None of the hits have been matched to a track create a new cluster if (matchedTrack == hitToTrack.end()) { - cluster.emplace(track->second.first, - std::vector(1, track->second.first)); + cluster.emplace(trackValue.first, + std::vector(1, trackValue.first)); for (const auto& hit : hits) { // Add the hits of the new cluster to the hitToTrack - hitToTrack.emplace(hit, track->second.first); + hitToTrack.emplace(hit, trackValue.first); } } } diff --git a/Core/src/TrackFinding/GbtsConnector.cpp b/Core/src/TrackFinding/GbtsConnector.cpp index acebffa9f74..d947894871c 100644 --- a/Core/src/TrackFinding/GbtsConnector.cpp +++ b/Core/src/TrackFinding/GbtsConnector.cpp @@ -9,6 +9,7 @@ // TODO: update to C++17 style #include "Acts/TrackFinding/GbtsConnector.hpp" +#include #include #include #include @@ -57,15 +58,8 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { continue; } - std::map>::iterator it = - m_connMap.find(stage); - - if (it == m_connMap.end()) { - std::vector v(1, pC); - m_connMap.insert(std::make_pair(stage, v)); - } else { - (*it).second.push_back(pC); - } + auto &connections = m_connMap[stage]; + connections.push_back(pC); } // re-arrange the connection stages @@ -74,9 +68,8 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { std::map> newConnMap; - for (const auto &conn : m_connMap) { - std::copy(conn.second.begin(), conn.second.end(), - std::back_inserter(lConns)); + for (const auto &[_, value] : m_connMap) { + std::ranges::copy(value, std::back_inserter(lConns)); } int stageCounter = 0; @@ -111,19 +104,19 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { std::set zeroLayers; - for (const auto &layerCounts : mCounter) { - if (layerCounts.second.second != 0) { + for (const auto &[key, value] : mCounter) { + if (value.second != 0) { continue; } - zeroLayers.insert(layerCounts.first); + zeroLayers.insert(key); } // remove connections which use zeroLayer as destination std::vector theStage; - std::list::iterator cIt = lConns.begin(); + auto cIt = lConns.begin(); while (cIt != lConns.end()) { if (zeroLayers.contains((*cIt)->m_dst)) { @@ -144,10 +137,9 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { // the doublet making is done using "outside-in" approach hence the reverse // iterations - for (std::map>::reverse_iterator it = - newConnMap.rbegin(); - it != newConnMap.rend(); ++it, currentStage++) { - const std::vector &vConn = (*it).second; + for (auto it = newConnMap.rbegin(); it != newConnMap.rend(); + it++, currentStage++) { + const auto &[_, vConn] = *it; // loop over links, extract all connections for the stage, group sources by // L1 (dst) index @@ -157,8 +149,7 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { for (const auto *conn : vConn) { unsigned int dst = conn->m_dst; - std::map>::iterator - l1MapIt = l1ConnMap.find(dst); + auto l1MapIt = l1ConnMap.find(dst); if (l1MapIt != l1ConnMap.end()) { (*l1MapIt).second.push_back(conn); } else { @@ -171,8 +162,8 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { lgv.reserve(l1ConnMap.size()); - for (const auto &l1Group : l1ConnMap) { - lgv.push_back(LayerGroup(l1Group.first, l1Group.second)); + for (const auto &[key, value] : l1ConnMap) { + lgv.emplace_back(LayerGroup(key, value)); } m_layerGroups.insert(std::make_pair(currentStage, lgv)); @@ -183,12 +174,9 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { GbtsConnector::~GbtsConnector() { m_layerGroups.clear(); - for (std::map>::iterator it = - m_connMap.begin(); - it != m_connMap.end(); ++it) { - for (std::vector::iterator cIt = (*it).second.begin(); - cIt != (*it).second.end(); ++cIt) { - delete (*cIt); + for (const auto &[_, connections] : m_connMap) { + for (auto *conn : connections) { + delete conn; } } } diff --git a/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp b/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp index 34d20e32e0a..dddd49e715a 100644 --- a/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp +++ b/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp @@ -589,10 +589,10 @@ Result AdaptiveMultiVertexFinder::deleteLastVertex( return removeResult.error(); } - for (auto& entry : fitterState.tracksAtVerticesMap) { + for (auto& [key, value] : fitterState.tracksAtVerticesMap) { // Delete all linearized tracks for current (bad) vertex - if (entry.first.second == &vtx) { - entry.second.isLinearized = false; + if (key.second == &vtx) { + value.isLinearized = false; } } diff --git a/Examples/Framework/src/Validation/TrackClassification.cpp b/Examples/Framework/src/Validation/TrackClassification.cpp index a89f7c2a07a..d1e79d15835 100644 --- a/Examples/Framework/src/Validation/TrackClassification.cpp +++ b/Examples/Framework/src/Validation/TrackClassification.cpp @@ -53,8 +53,9 @@ void ActsExamples::identifyContributingParticles( for (auto hitIndex : protoTrack) { // register all particles that generated this hit - for (auto hitParticle : makeRange(hitParticlesMap.equal_range(hitIndex))) { - increaseHitCount(particleHitCounts, hitParticle.second); + for (const auto& [_, value] : + makeRange(hitParticlesMap.equal_range(hitIndex))) { + increaseHitCount(particleHitCounts, value); } } sortHitCount(particleHitCounts); @@ -79,8 +80,9 @@ void ActsExamples::identifyContributingParticles( IndexSourceLink sl = state.getUncalibratedSourceLink().template get(); auto hitIndex = sl.index(); - for (auto hitParticle : makeRange(hitParticlesMap.equal_range(hitIndex))) { - increaseHitCount(particleHitCounts, hitParticle.second); + for (const auto& [_, value] : + makeRange(hitParticlesMap.equal_range(hitIndex))) { + increaseHitCount(particleHitCounts, value); } return true; }); @@ -102,8 +104,9 @@ void ActsExamples::identifyContributingParticles( IndexSourceLink sl = state.getUncalibratedSourceLink().template get(); auto hitIndex = sl.index(); - for (auto hitParticle : makeRange(hitParticlesMap.equal_range(hitIndex))) { - increaseHitCount(particleHitCounts, hitParticle.second); + for (const auto& [_, value] : + makeRange(hitParticlesMap.equal_range(hitIndex))) { + increaseHitCount(particleHitCounts, value); } } sortHitCount(particleHitCounts); diff --git a/Examples/Io/Root/src/RootNuclearInteractionParametersWriter.cpp b/Examples/Io/Root/src/RootNuclearInteractionParametersWriter.cpp index e0d635443e5..995f7bdf57d 100644 --- a/Examples/Io/Root/src/RootNuclearInteractionParametersWriter.cpp +++ b/Examples/Io/Root/src/RootNuclearInteractionParametersWriter.cpp @@ -227,7 +227,7 @@ std::pair, std::vector> buildMap( } /// @brief This method builds decomposed cumulative probability distributions -/// out of a vector of proability distributions +/// out of a vector of probability distributions /// /// @param [in] histos Vector of probability distributions /// @@ -410,27 +410,27 @@ ActsExamples::RootNuclearInteractionParametersWriter::finalize() { gDirectory->WriteObject(&mapNIprob.second, "NuclearInteractionBinContents"); ACTS_DEBUG("Nuclear interaction probability parametrised"); - ACTS_DEBUG("Starting calulcation of probability of interaction type"); - // Write the interaction type proability + ACTS_DEBUG("Starting calculation of probability of interaction type"); + // Write the interaction type probability const auto softProbability = Parametrisation::softProbability(m_eventFractionCollection); gDirectory->WriteObject(&softProbability, "SoftInteraction"); - ACTS_DEBUG("Calulcation of probability of interaction type finished"); + ACTS_DEBUG("Calculation of probability of interaction type finished"); // Write the PDG id production distribution ACTS_DEBUG( - "Starting calulcation of transition probabilities between PDG IDs"); + "Starting calculation of transition probabilities between PDG IDs"); const auto pdgIdMap = Parametrisation::cumulativePDGprobability(m_eventFractionCollection); std::vector branchingPdgIds; std::vector targetPdgIds; std::vector targetPdgProbability; - for (const auto& targetPdgIdMap : pdgIdMap) { - for (const auto& producedPdgIdMap : targetPdgIdMap.second) { - branchingPdgIds.push_back(targetPdgIdMap.first); - targetPdgIds.push_back(producedPdgIdMap.first); - targetPdgProbability.push_back(producedPdgIdMap.second); + for (const auto& [targetKey, targetValue] : pdgIdMap) { + for (const auto& [producedKey, producedValue] : targetValue) { + branchingPdgIds.push_back(targetKey); + targetPdgIds.push_back(producedKey); + targetPdgProbability.push_back(producedValue); } } @@ -438,7 +438,7 @@ ActsExamples::RootNuclearInteractionParametersWriter::finalize() { gDirectory->WriteObject(&targetPdgIds, "TargetPdgIds"); gDirectory->WriteObject(&targetPdgProbability, "TargetPdgProbability"); ACTS_DEBUG( - "Calulcation of transition probabilities between PDG IDs finished"); + "Calculation of transition probabilities between PDG IDs finished"); // Write the multiplicity and kinematics distribution ACTS_DEBUG("Starting parametrisation of multiplicity probabilities"); diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp index 79397aba878..788ac36aca5 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp @@ -170,7 +170,7 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, } } } - return std::tie(pSurfaces, pGrid, highlightIndices); + return {pSurfaces, pGrid, highlightIndices}; } /// @brief Convert the single delegate if it is of the type of the reference diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp index 38189871efb..d2326694b5d 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp @@ -59,7 +59,7 @@ struct Style { str._hl_width = highlightStrokeWidth; str._dasharray = strokeDasharray; - return std::tie(fll, str); + return {fll, str}; } /// Conversion to fill, stroke and font diff --git a/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp b/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp index 794bb1d43b5..5cffbe73a1a 100644 --- a/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp +++ b/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp @@ -206,5 +206,5 @@ Acts::Svg::SurfaceArrayConverter::convert( // Return the surfaces and the grid std::vector pSurfaceBatches = {pSurfaces}; std::vector pAssociationBatchs = {pAssociations}; - return std::tie(pSurfaceBatches, pGrid, pAssociationBatchs); + return {pSurfaceBatches, pGrid, pAssociationBatchs}; } diff --git a/Plugins/DD4hep/src/DD4hepDetectorStructure.cpp b/Plugins/DD4hep/src/DD4hepDetectorStructure.cpp index ca4ae439004..00a5017fca9 100644 --- a/Plugins/DD4hep/src/DD4hepDetectorStructure.cpp +++ b/Plugins/DD4hep/src/DD4hepDetectorStructure.cpp @@ -75,7 +75,7 @@ Acts::Experimental::DD4hepDetectorStructure::construct( detail::BlueprintDrawer::dotStream(bpf, *dd4hepBlueprint); bpf.close(); // Return without building - return std::tie(detector, detectorStore); + return {detector, detectorStore}; } // Create a Cylindrical detector builder from this blueprint @@ -100,5 +100,5 @@ Acts::Experimental::DD4hepDetectorStructure::construct( "DD4hepDetectorStructure: Only cylindrical detectors are (currently) " "supported."); } - return std::tie(detector, detectorStore); + return {detector, detectorStore}; } diff --git a/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp b/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp index b7717073036..581130a8852 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp @@ -83,7 +83,7 @@ updator_type generateFromJson(const nlohmann::json& jUpdater, -> std::tuple, std::size_t> { std::array range = jAxis["range"]; std::size_t bins = jAxis["bins"]; - return std::make_tuple(range, bins); + return {range, bins}; }; /// Helper extractor for variable axis diff --git a/Plugins/Json/src/DetrayJsonHelper.cpp b/Plugins/Json/src/DetrayJsonHelper.cpp index aa61a9d8aeb..e902657da21 100644 --- a/Plugins/Json/src/DetrayJsonHelper.cpp +++ b/Plugins/Json/src/DetrayJsonHelper.cpp @@ -50,7 +50,7 @@ std::tuple> maskFromBounds( break; } } - return std::tie(type, boundaries); + return {type, boundaries}; } void addVolumeLink(nlohmann::json& jSurface, int vLink) { diff --git a/Plugins/Json/src/MaterialMapJsonConverter.cpp b/Plugins/Json/src/MaterialMapJsonConverter.cpp index 76fc01f8569..2424156ec1d 100644 --- a/Plugins/Json/src/MaterialMapJsonConverter.cpp +++ b/Plugins/Json/src/MaterialMapJsonConverter.cpp @@ -253,8 +253,8 @@ nlohmann::json Acts::MaterialMapJsonConverter::materialMapsToJson( VolumeMaterialMap volumeMap = maps.second; std::vector> mapVolumeInit; - for (auto it = volumeMap.begin(); it != volumeMap.end(); it++) { - mapVolumeInit.push_back({it->first, it->second.get()}); + for (const auto& [key, value] : volumeMap) { + mapVolumeInit.push_back({key, value.get()}); } GeometryHierarchyMap hierarchyVolumeMap( mapVolumeInit); @@ -263,8 +263,8 @@ nlohmann::json Acts::MaterialMapJsonConverter::materialMapsToJson( SurfaceMaterialMap surfaceMap = maps.first; std::vector> mapSurfaceInit; - for (auto it = surfaceMap.begin(); it != surfaceMap.end(); it++) { - mapSurfaceInit.push_back({it->first, it->second.get()}); + for (const auto& [key, value] : surfaceMap) { + mapSurfaceInit.push_back({key, value.get()}); } GeometryHierarchyMap hierarchySurfaceMap( mapSurfaceInit); diff --git a/Tests/UnitTests/Core/Utilities/KDTreeTests.cpp b/Tests/UnitTests/Core/Utilities/KDTreeTests.cpp index b1a70c399c7..15146e2eb60 100644 --- a/Tests/UnitTests/Core/Utilities/KDTreeTests.cpp +++ b/Tests/UnitTests/Core/Utilities/KDTreeTests.cpp @@ -482,12 +482,10 @@ BOOST_FIXTURE_TEST_CASE(range_search_combinatorial, TreeFixture3DDoubleInt2) { std::vector valid; - for (const std::pair, int>& i : - test_vector) { - const std::array& c = i.first; + for (const auto& [c, value] : test_vector) { if (xmin <= c[0] && c[0] < xmax && ymin <= c[1] && c[1] < ymax && zmin <= c[2] && c[2] < zmax) { - valid.push_back(i.second); + valid.push_back(value); } }