Is there a reason on not allowing lambdas to deduce the return type if it contains more than one statement?

前端 未结 4 568
情话喂你
情话喂你 2020-12-20 20:43

Taken from the C++0x FDIS (n3290):

If a lambda-expression does not include a lambda-declarator, it is as if the lambda-declarator were (). If a lambda

4条回答
  •  温柔的废话
    2020-12-20 21:08

    There's no technical reason for this. IIRC it was already implemented by the GCC C++ maintainer and he said it's trivial to implement.

    The committee is very conservative about accepting features into the Standard so they went with this simple form of deduction and will later hopefully accept a more powerful form. See the reason for rejection on US 30 comment.

    DR 975 is already marked "ready" so chances are good it will be accepted.

提交回复
热议问题