C++ weird expressions are compiled just fine

The first is a lambda with no parameter list and a subsequent call.
[]{} is equivalent to [](){} so the whole line is equivalent to

[](){}();

The second is a pair of braces, which introduce and then immediately close a scope, followed by an unused lambda definition with no parameter list:

{
  // empty scope
}
[]{}; // lambda

You can refer to http://en.cppreference.com/w/cpp/language/lambda for the variations on lambda definition syntax.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)