The above works. But if I used std::min directly as an argument to func, then it's not allowed. I get that part (that it's not allowed). But what makes generic lambdas special? Also is there a good way to reuse the...
C++ doesn't allow template arguments to depend on stuff outside the immediate context of the substitution: that is, in the signature of the candidate function.
Lambdas get around this by not depending on stuff inside the function. It's not a template, but an instance of a class which defines a member function template named ClosureType::operator().
Rather than std::min, you would usually pass an instance of std::less<void>. That's another class whose operator() deduces the types of its operands:
func(std::less<>{})
Also is there a good way to reuse [...] without a macro?
Awesome, thanks. Makes sense; the generic lambda is still an instance, just one that has a template operator() inside it. Is there a library equivalent for all the algorithms though? I get that min/max is std::less, but what about say std::replace?