Skip to content
Snippets Groups Projects
Commit 3fbdbd9c authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Change passing by const reference to value


Signed-off-by: default avatarSteven Hahn <hahnse@ornl.gov>
parent 2bd701b8
No related branches found
No related tags found
No related merge requests found
...@@ -33,13 +33,13 @@ void Minus::performBinaryOperation(const HistogramData::Histogram &lhs, ...@@ -33,13 +33,13 @@ void Minus::performBinaryOperation(const HistogramData::Histogram &lhs,
HistogramData::HistogramE &EOut) { HistogramData::HistogramE &EOut) {
using std::placeholders::_1; using std::placeholders::_1;
std::transform(lhs.y().begin(), lhs.y().end(), YOut.begin(), std::transform(lhs.y().begin(), lhs.y().end(), YOut.begin(),
[rhsY](const double &l) { return l - rhsY; }); [rhsY](double l) { return l - rhsY; });
// Only do E if non-zero, otherwise just copy // Only do E if non-zero, otherwise just copy
if (rhsE != 0) { if (rhsE != 0) {
double rhsE2 = rhsE * rhsE; double rhsE2 = rhsE * rhsE;
std::transform( std::transform(
lhs.e().begin(), lhs.e().end(), EOut.begin(), lhs.e().begin(), lhs.e().end(), EOut.begin(),
[rhsE2](const double &l) { return std::sqrt(l * l + rhsE2); }); [rhsE2](double l) { return std::sqrt(l * l + rhsE2); });
} else } else
EOut = lhs.e(); EOut = lhs.e();
} }
......
...@@ -36,14 +36,14 @@ void Plus::performBinaryOperation(const HistogramData::Histogram &lhs, ...@@ -36,14 +36,14 @@ void Plus::performBinaryOperation(const HistogramData::Histogram &lhs,
HistogramData::HistogramE &EOut) { HistogramData::HistogramE &EOut) {
using std::placeholders::_1; using std::placeholders::_1;
std::transform(lhs.y().begin(), lhs.y().end(), YOut.begin(), std::transform(lhs.y().begin(), lhs.y().end(), YOut.begin(),
[rhsY](const double &l) { return l + rhsY; }); [rhsY](double l) { return l + rhsY; });
// Only do E if non-zero, otherwise just copy // Only do E if non-zero, otherwise just copy
if (rhsE != 0.) { if (rhsE != 0.) {
double rhsE2 = rhsE * rhsE; double rhsE2 = rhsE * rhsE;
std::transform( std::transform(
lhs.e().begin(), lhs.e().end(), EOut.begin(), lhs.e().begin(), lhs.e().end(), EOut.begin(),
[rhsE2](const double &l) { return std::sqrt(l * l + rhsE2); }); [rhsE2](double l) { return std::sqrt(l * l + rhsE2); });
} else } else
EOut = lhs.e(); EOut = lhs.e();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment