When you wrap a lambda into a std::function variable, it involves a call to a virtual function which add overheads (often unnoticed unless you repeat the call several times), so a regular recursive functor would be even faster.
The subject was discussed in the following threads:
The subject was discussed in the following threads:
http://stackoverflow.com/questions/2067988/recursive-lambda-...
http://stackoverflow.com/questions/17066667/overhead-of-recu...