От: | Nikita.Trophimov | ||
Дата: | 01.03.13 04:15 | ||
Оценка: |
int main()
{
void (*fp)() = [&]{}; // Ok
}
int main()
{
int foo;
void (*fp)() = [&]{ foo = 0; }; // error: cannot convert 'main()::<lambda()>' to 'void (*)()' in initialization
}
int main()
{
int foo;
void (*fp)() = [&foo]{}; // error: cannot convert 'main()::<lambda()>' to 'void (*)()' in initialization
}
6 The closure type for a lambda-expression with no lambda-capture has a public non-virtual non-explicit const
conversion function to pointer to function having the same parameter and return types as the closure type’s
function call operator.