I'm messing around with new C++20 lambdas, it seems I can declare a lambda taking a non type template param, but then I'm not able to call it.
#include <iostream>
int main() {
// compiles fine
auto f = []<bool ok>() { return ok; };
// it even has an address??
std::cout << &f;
// f(); // error : no matching function for call to object of typ
// f<true>(); // error : invalid operands to binary expression
f.operator()<true>(); // compiles but somewhat... ugly
}
I looked at the relevant paper here but it doesn't seem to mention the calling syntax in such a case.
Is explicitly passing template arguments at the lambda call site forbidden? It would be a disappointing limitation, as I thought the intention was to make lambdas able to do as much as templates.