Please note that in your code you are NOT a Lambda CALL .
while([&]() { return true; })
Without a call, this is not a lambda return value, which is problematic.
A lambda that does not capture anything can be implicitly converted to a function pointer, which in turn can convert to bool .
The following compilation with g ++ 4.7.2, but not with Visual C ++ 12.0:
int main() { if( [](){} ) {} }
Below, where the lambda does the capture (and therefore cannot be converted), it does not compile with the compiler:
int main() { int x; if( [&](){(void)x;} ) {} }
Cheers and hth. - alf
source share