Skip to content

Commit 7e179b1

Browse files
committed
Remove std::plus
1 parent 534daa9 commit 7e179b1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/ipc/potentials/friction_potential.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ Eigen::VectorXd FrictionPotential::force(
5252
}
5353
});
5454

55-
return storage.combine(std::plus<const Eigen::VectorXd&>());
55+
return storage.combine([](const Eigen::VectorXd& a,
56+
const Eigen::VectorXd& b) { return a + b; });
5657
}
5758

5859
Eigen::SparseMatrix<double> FrictionPotential::force_jacobian(

src/ipc/potentials/potential.tpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ double Potential<TCollisions>::operator()(
3131
}
3232
return partial_sum;
3333
},
34-
std::plus<double>());
34+
[](double a, double b) { return a + b; });
3535
}
3636

3737
template <class TCollisions>
@@ -67,7 +67,9 @@ Eigen::VectorXd Potential<TCollisions>::gradient(
6767
}
6868
});
6969

70-
return grad.combine(std::plus<const Eigen::VectorXd&>());
70+
return grad.combine([](const Eigen::VectorXd& a, const Eigen::VectorXd& b) {
71+
return a + b;
72+
});
7173
}
7274

7375
template <class TCollisions>
@@ -127,7 +129,9 @@ Eigen::SparseMatrix<double> Potential<TCollisions>::hessian(
127129
}
128130
});
129131

130-
return hess.combine(std::plus<const Eigen::SparseMatrix<double>&>());
132+
return hess.combine(
133+
[](const Eigen::SparseMatrix<double>& a,
134+
const Eigen::SparseMatrix<double>& b) { return a + b; });
131135
}
132136

133137
} // namespace ipc

0 commit comments

Comments
 (0)