Comment

Comment by _lm_

It's more readable, but using std::function here introduces a second layer of indirection vs using a plain function pointer.

More specifically, std::function's operator() is virtual, and calls into a subclass that's specialized to function pointers of type void(int). The subclass then performs the actual function pointer call.

parent _lm_ 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton