I like to pass std::max or std::min into a function. One can write code like this
Definition of the function
void foo (std::function<double(double, double)> extreme) {
...
const double e = extreme(rhs, lhs);
...
}
On can call the function using a lambda
foo([](const double rhs, const double lhs) { return std::max(rhs, lhs); });
This is quite ugly. I would prefer to write code like this
foo(std::max);
This does not compile. Is this or something more readable possible?