Skip to content

Commit

Permalink
Don't use bind2nd, which is apparently deprecated now.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed May 9, 2020
1 parent 9e596dc commit f77f87c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/PhotonArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,22 @@ namespace galsim {
scaleFlux(flux / oldFlux);
}

struct Scaler
{
Scaler(double _scale): scale(_scale) {}
double operator()(double x) { return x * scale; }
double scale;
};

void PhotonArray::scaleFlux(double scale)
{
std::transform(_flux, _flux+_N, _flux,
std::bind2nd(std::multiplies<double>(),scale));
std::transform(_flux, _flux+_N, _flux, Scaler(scale));
}

void PhotonArray::scaleXY(double scale)
{
std::transform(_x, _x+_N, _x,
std::bind2nd(std::multiplies<double>(),scale));
std::transform(_y, _y+_N, _y,
std::bind2nd(std::multiplies<double>(),scale));
std::transform(_x, _x+_N, _x, Scaler(scale));
std::transform(_y, _y+_N, _y, Scaler(scale));
}

void PhotonArray::assignAt(int istart, const PhotonArray& rhs)
Expand Down

0 comments on commit f77f87c

Please sign in to comment.