Skip to content

Commit

Permalink
Merge pull request #2569 from e-kwsm/bind2nd
Browse files Browse the repository at this point in the history
refactor: remove deprecated std::bind2nd
  • Loading branch information
ghutchis committed Jul 14, 2023
2 parents 6275946 + f334129 commit f827a72
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/confsearch.cpp
Expand Up @@ -131,7 +131,7 @@ namespace OpenBabel

const double arr[] = {3.0, 2.0, 1.5, 1.0, 0.5, 0.25};
std::vector<double> vec (arr, arr + sizeof(arr) / sizeof(arr[0]) );
vec.erase(std::remove_if(vec.begin(), vec.end(), std::bind2nd(std::less<double>(), (cutoff + 0.1) )), vec.end());
vec.erase(std::remove_if(vec.begin(), vec.end(), [=](double v) { return v < cutoff + 0.1; }), vec.end());
vec.push_back(cutoff);

levels = vec;
Expand Down Expand Up @@ -443,7 +443,7 @@ int OBForceField::DiverseConfGen(double rmsd, unsigned int nconfs, double energy
UpdateConformersFromTree(&_mol, _energies, &divposes, verbose);

// Add back the energy offset
transform(_energies.begin(), _energies.end(), _energies.begin(), bind2nd(std::plus<double>(), energy_offset));
transform(_energies.begin(), _energies.end(), _energies.begin(), [=](double e) { return e + energy_offset; });

// Clean up
delete [] store_initial;
Expand Down
8 changes: 4 additions & 4 deletions src/formats/fchkformat.cpp
Expand Up @@ -665,16 +665,16 @@ namespace OpenBabel
no atom numbers < 0 or > Natoms */
if (NBond.end() != find_if(NBond.begin(),
NBond.end(),
bind2nd(less_equal<int>(), 0)) ||
[](int i) { return i <= 0; }) ||
NBond.end() != find_if(NBond.begin(),
NBond.end(),
bind2nd(greater<int>(), MxBond)) ||
[=](int i) { return i > MxBond; }) ||
IBond.end() != find_if(IBond.begin(),
IBond.end(),
bind2nd(less<int>(), 0)) ||
[](int i) { return i < 0; }) ||
IBond.end() != find_if(IBond.begin(),
IBond.end(),
bind2nd(greater<int>(), Natoms)))
[=](int i) { return i > Natoms; }))
{
error_msg << "Invalid connectivity : check the \"NBond\" and/or"
<< " \"IBond\" section(s).";
Expand Down
4 changes: 2 additions & 2 deletions src/formats/vaspformat.cpp
Expand Up @@ -534,7 +534,7 @@ namespace OpenBabel {
for (size_t natom = 0; natom < pmol->NumAtoms(); ++natom) {
const vector3 dxyz = currXyz[natom] - prevXyz[natom];
vector3::const_iterator iter = std::find_if(dxyz.begin(), dxyz.end(),
std::bind2nd(std::not_equal_to<double>(), 0.0));
[](double v) { return v != 0.0; });
if (iter != dxyz.end()) dipGrad[natom].SetRow(iter - dxyz.begin(),
(currDm - prevDm) / *iter);
}
Expand Down Expand Up @@ -588,7 +588,7 @@ namespace OpenBabel {
if (max != 0.0) {
// Normalize
std::transform(Intensities.begin(), Intensities.end(), Intensities.begin(),
std::bind2nd(std::divides<double>(), max / 100.0));
[=](double v) { return v / (max / 100.0); });
} else {
Intensities.clear();
}
Expand Down

0 comments on commit f827a72

Please sign in to comment.