I found out that in C++ we can use + in lambda function +[]{}
Example from the article:
#include <iostream>
#include <type_traits>
int main()
{
auto funcPtr = +[] {};
static_assert(std::is_same<decltype(funcPtr), void (*)()>::value);
}
The main idea of + sign in lambda
You can force the compiler to generate lambda as a function pointer rather than closure by adding + in front of it as above.
But what are advantages of using '+' in lambda? Could you please provide example or link me to the explanation?