简体   繁体   中英

Why C++14 Generic lambdas require auto in parameters specification?

I look at Generic lambdas and cant get it - why keep type declaration at all? why not (x, y) ? If compiler vendors will have to support (auto a, auto b) Are there any problems supporting simple (a, b) ?

The problem is that you are also allowed to leave out the parameter's name. If the compiler sees (a,b) and a and b are also valid types, what should that mean? (a /*dummy_a*/, b /*dummy_b*/) or (auto a, auto b) ? With having to type auto explicitly, it is no longer ambiguous.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM