Is a C++ is_lambda trait, purely implemented as a library, impossible?

I don't believe that it can be done- lambdas aren't really anything new semantically, they're just compiler-generated functors and thus will look identical to regular functors.


Since evaluation of lambda results in creating closure object, there isn't any difference as soon as the object passed to a function or copied. And, frankly, I can't imagine a problem that would require to know whether an object came from lambda.

Edit. A standard even has a note in 5.1.2/2:

Note: a closure object behaves like a function object (20.8).—end note