Skip to content

Commit

Permalink
Fix range-loop-construct warnings. (#335)
Browse files Browse the repository at this point in the history
Complaints about implicit copying that can be avoided with references.
The current code will fail to compile with gcc@11: due to -Werror.
  • Loading branch information
matz-e authored Dec 14, 2021
1 parent 5b2dc3a commit bbac413
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions brain/neuron/soma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ glm::vec3 _computeCentroid(const Vector4fs& points)
centroid /= static_cast<float>(points.size());
return centroid;
}
}
} // namespace

Soma::Soma(Morphology::ImplPtr morphology)
: _morphology(morphology)
Expand Down Expand Up @@ -69,7 +69,7 @@ float Soma::getMeanRadius() const

const auto centroid = _computeCentroid(points);
float radius = 0;
for (const auto point : points)
for (const auto& point : points)
radius += glm::length(glm::vec3(point) - centroid);
return radius /= float(points.size());
}
Expand Down Expand Up @@ -105,5 +105,5 @@ Sections Soma::getChildren() const
result.push_back(Section(id, _morphology));
return result;
}
}
}
} // namespace neuron
} // namespace brain
2 changes: 1 addition & 1 deletion brion/plugin/compartmentReportHDF5Sonata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ bool CompartmentReportHDF5Sonata::_loadFrame(const size_t frameNumber,
// Reading slice by slice and processing all cells contained in a given
// slice
size_t targetOffset = 0;
for (const auto interval : intervals)
for (const auto& interval : intervals)
{
const auto sourceOffset = interval.first;
const auto count = interval.second - sourceOffset;
Expand Down
2 changes: 1 addition & 1 deletion brion/simulationConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ std::string SimulationConfig::getSpikesFilepath() const
Strings SimulationConfig::getCompartmentReportNames() const
{
Strings names;
for (const auto item : _impl->reportFilepaths)
for (const auto& item : _impl->reportFilepaths)
names.push_back(item.first);
return names;
}
Expand Down

0 comments on commit bbac413

Please sign in to comment.