#include <iostream>
using namespace std;
int main()
{
static bool temp([]{
cout <<"Hi ";
return false;});
cout <<"temp "<< temp;
return 0;
}
It does not execute lambda. But if we declare lambda separately like:
#include <iostream>
using namespace std;
int main()
{
auto lambda = []{
cout <<"Hi ";
return false;};
static bool temp(lambda());
cout <<"temp "<< temp;
return 0;
}
It will execute it. What am I missing here?
[]to[=]and see what happens.