Complex initialization for a const variable
April 13th, 2013
No comments
int main()
{
bool someFlag = false;
const auto value = [&]{
if(someFlag)
return -1;
else
return 1;
} ();
std::cout << "value == " << value << std::endl;
return 0;
}
