Wednesday 20 December 2017

lambda - Advanced C++ multiple parentheses





I'm reviewing a sample program code and found this
line:




auto prerequisite
=
task([](){});


What
is the meaning of those combined parentheses
([](){})



I'm a cpp
programmer but do not know advance cpp (c11+) which this Microsoft example is written
at. Googling didn't help, and I don't know the name of those
operators.


itemprop="text">
class="normal">Answer




[](){} is a href="https://en.cppreference.com/w/cpp/language/lambda" rel="noreferrer">lambda
expression that creates a function object that has non-zero size and does
nothing.



This is probably to avoid checking
whether prerequisite is valid/exists - it is always valid, but
may do nothing.



No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...