I’ve recently read this blog post by Vittorio Romeo.
He talks about various ways to pass a function (callback, comparator for algorithm, etc.) to another function.
One of them is
function_view is a lightweight
it should be able to refer to any callable with a given signature.
std::function it does not own the callable,
just refers to it.
This allows a much more efficient implementation.
In this post he presented one. But his has a flaw, that can bite you very easily.» read more »