The call itself is not recursive. It returns a function object, which, if called, will call terminal again to create another function object.
So, terminal(stdout) returns a functor that captures stdout and can be called by another function object. Calling it again, (hello) , calls the hello functor with the captured member stdout , outputting "Hello" ; calls terminal and returns another functor, which this time captures the return value of hello - which is still stdout . Call this functor (world) , over and over again, displaying "World" .
Mike Seymour Sep 02 '14 at 8:33 2014-09-02 08:33
source share