Skip to content

Commit

Permalink
build: Fix C++20 warnings (#2035)
Browse files Browse the repository at this point in the history
  • Loading branch information
trisyoungs authored Jan 14, 2025
1 parent 0c99832 commit 9b27472
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/expression/binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "expression/binary.h"
#include "math/mathFunc.h"
#include <cmath>

ExpressionBinaryOperatorNode::ExpressionBinaryOperatorNode(BinaryOperator op) : ExpressionNode(), operator_(op) {}

Expand Down
6 changes: 3 additions & 3 deletions src/gui/render/axes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ void Axes::transformX(std::vector<double> &xArray) const
for (auto n = 0; n < xArray.size(); ++n)
xArray[n] = log10(xArray[n]) * stretch_.x;
else
std::transform(xArray.begin(), xArray.end(), xArray.begin(), [=](auto value) { return value * stretch_.x; });
std::transform(xArray.begin(), xArray.end(), xArray.begin(), [this](auto value) { return value * stretch_.x; });
}

// Return supplied data y value in local axes coordinates
Expand Down Expand Up @@ -494,7 +494,7 @@ void Axes::transformY(std::vector<double> &yArray) const
yArray[n] = log10(yArray[n]) * stretch_.y;
}
else
std::transform(yArray.begin(), yArray.end(), yArray.begin(), [=](auto value) { return value * stretch_.y; });
std::transform(yArray.begin(), yArray.end(), yArray.begin(), [this](auto value) { return value * stretch_.y; });
}

// Return supplied data z value in local axes coordinates
Expand Down Expand Up @@ -527,7 +527,7 @@ void Axes::transformZ(std::vector<double> &zArray) const
zArray[n] = log10(zArray[n]) * stretch_.z;
}
else
std::transform(zArray.begin(), zArray.end(), zArray.begin(), [=](auto value) { return value * stretch_.z; });
std::transform(zArray.begin(), zArray.end(), zArray.begin(), [this](auto value) { return value * stretch_.z; });
}

// Transform a 2D array of values into local axes coordinates
Expand Down
2 changes: 1 addition & 1 deletion src/io/import/cif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ std::pair<double, std::vector<int>> CIFHandler::differenceMetric(const Species *
const auto &closestMolSpAtom = molecule.species()->atom(atomIndexMap[spI]);
difference += distanceSq;
if (spAtom.Z() != closestMolSpAtom.Z())
difference += std::max(spAtom.Z(), closestMolSpAtom.Z()) * 10.0;
difference += std::max(int(spAtom.Z()), int(closestMolSpAtom.Z())) * 10.0;
}

return {difference, atomIndexMap};
Expand Down
6 changes: 3 additions & 3 deletions src/modules/neutronSQ/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ bool NeutronSQModule::setUp(ModuleContext &moduleContext, Flags<KeywordBase::Key
switch (referenceNormalisedTo_)
{
case (StructureFactors::NoNormalisation):
factor = 1.0 / normaliseTo_ == StructureFactors::SquareOfAverageNormalisation
? weights.boundCoherentSquareOfAverage()
: weights.boundCoherentAverageOfSquares();
factor = 1.0 / (normaliseTo_ == StructureFactors::SquareOfAverageNormalisation
? weights.boundCoherentSquareOfAverage()
: weights.boundCoherentAverageOfSquares());
break;
case (StructureFactors::SquareOfAverageNormalisation):
factor = weights.boundCoherentSquareOfAverage();
Expand Down
8 changes: 4 additions & 4 deletions tests/pairPotentials/analytic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ class PairPotentialsAnalyticTest : public ::testing::Test
void testEnergy(Functions1D::Form form, std::string_view parameters, double rStart = testRDelta_)
{
test(
form, parameters, rStart, [=](double r) { return pairPotential_->analyticEnergy(r, 1.0, 1.0); },
[=](double r) { return pairPotential_->energy(r); });
form, parameters, rStart, [this](double r) { return pairPotential_->analyticEnergy(r, 1.0, 1.0); },
[this](double r) { return pairPotential_->energy(r); });
}
// Test analytic vs tabulated force for specified form and parameters
void testForce(Functions1D::Form form, std::string_view parameters, double rStart = testRDelta_)
{
test(
form, parameters, rStart, [=](double r) { return pairPotential_->analyticForce(r, 1.0, 1.0); },
[=](double r) { return pairPotential_->force(r); });
form, parameters, rStart, [this](double r) { return pairPotential_->analyticForce(r, 1.0, 1.0); },
[this](double r) { return pairPotential_->force(r); });
}
};

Expand Down

0 comments on commit 9b27472

Please sign in to comment.