+ 3

Does lambda work with only capture clause

I always belived that lambda needs min three things: [] capture clause () input param list {} function body All of these 3 are needed be it with something inside it or atleast empty Plz refer code below: Callable objects for t3 and t4 threads are lambda. One of them works without () i.e. input paramters. Hows it is working ? New addition to c++ and since when ? https://code.sololearn.com/c62tJ9Eza8A6/?ref=app

23rd Dec 2022, 6:07 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Resposta
+ 4
The parameter list has always been an optional field for lambda function. Check cppreference to see different possible syntax of lambda expressions 👇 https://en.cppreference.com/w/cpp/language/lambda
24th Dec 2022, 1:16 AM
Arsenic
Arsenic - avatar