What is the usage of lambda trailing return type auto?
问题 What is the usage of adding -> auto in []() -> auto { return 4; } ? For me - it is not different than []() { return 4; } 回答1: It is auto by default. The Standard, [expr.prim.lambda]/4, reads: If a lambda-expression does not include a lambda-declarator , it is as if the lambda-declarator were () . The lambda return type is auto , which is replaced by the trailing-return-type if provided and/or deduced from return statements as described in [dcl.spec.auto]. My addition. So, -> auto itself is