When I need to implement a recursive lambda, usually I do it like this:
auto factorial = [](auto& self, int n) -> int {
return n == 0 ? 1 : n * self(self, n - 1);
};
and call it with factorial(factorial, n). However, I've seen people declaring the parameter self with type auto&& instead of auto&. What's the difference?