3 ms·
Why is it inefficient with recursion? I know that at least non-recursive usage of std::function is generally well-optimized by most compilers.
by TillE 12y ago
Why is it inefficient with recursion? I know that at least non-recursive usage of std::function is generally well-optimized by most compilers.
- pmelendez 12y agoWhen 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: http://stackoverflow.com/questions/2067988/recursive-lambda-functions-in-c0x/14591727#14591727 http://stackoverflow.com/questions/2067988/recursive-lambda-... http://stackoverflow.com/questions/17066667/overhead-of-recursive-lambdas/17067042#17067042 http://stackoverflow.com/questions/17066667/overhead-of-recu...