mercredi 17 avril 2019

lambdas in unevaluated contexts (Until C++2a)

I am currently reading P0215R1 paper which talks about Lambdas in unevaluated contexts

There is a statement in the document which explains why lambdas can't appear in unevaluated contexts (of course only until C++2a) as below:

Lambdas are a very powerful language feature, especially when it comes to using higher-order algorithms with custom predicates or expressing small, disposable pieces of code. Yet, they suffer from one important limitation which cripples their usefulness for creative use cases; they can’t appear in unevaluated contexts. This restriction was originally designed to prevent lambdas from appearing in signatures, which would have opened a can of worm for mangling because lambdas are required to have unique types.

Can somebody please explain this statement with an example?

Aucun commentaire:

Enregistrer un commentaire