Replace local std::function with recursive lambda
This replaces a local std::function which is used recursively with a recursive lambda, which should be more performant generally.
This replaces a local std::function which is used recursively with a recursive lambda, which should be more performant generally.