Search code examples
d

Void lambda function


Is it possible to express the following function as a lambda expression?

void f()
{
    return;
}

It is meant to be used as an alias in a template.


Solution

  • (){} should work. It uses the old-style lambda syntax, without the arrow. () => {} should also work, but there seems to be some kinda bug that prevents assignment from it to a void function() variable. Works great for template alias parameters, though.