auto
l = [](){};
Look at all those brackets!
I encountered this when reading this blog ("http://blog.3d-logic.com/2014/12/08/c-async-development-not-only-for-for-c-developers-part-i-lambda-functions/").
It's a C++ lambda function and equivalent to this C# code:
Action l = () => {};
In C#, an Action type is a delegate (a function pointer) that returns null. The pair of empty parentheses means there is no parameter for this function. The empty curly braces means it's not doing any operation at all.
So in summary... it's a piece of code that accepts no parameter, doesn't do anything, and returns nothing. Effectively useless. But nevertheless valid code. And quite beautiful too.
No comments:
Post a Comment