Since C++ 20, the concepts have been released to constrain templates and auto.
I wanted to create a concept that only defines a lambda, is it possible?
template <typename T>
concept lambda = /* ... */ ;
And then I could apply like this:
int add(int x, int y) {
return x + y;
}
lambda auto func1 = []{ return 5; }; // constrain satisfied
lambda auto func2 = add; // constrain unsatisfied, compilation error.