template<typename Return_type, typename... Args>
class ut::Function_reference< Return_type(Args...)>
A non-owning reference to a callable - a free function, like sin, or the operator() of an object, together with pointer to that object, such a Less functor or a lambda.
It is the users responsibility to ensure that the lifetime of the callable referenced covers the lifetime of this Function_reference. This is the price to be paid for the benefit that this object has fixed size (just two pointers) and does not require dynamic allocation, which makes it useful for callbacks and type erasure, in places where std::function would be to expensive due to its need to copy the (variable size) object to dynamically allocated space.
template<typename Return_type , typename... Args>
How to call the referenced function given the m_context.
In case of an object's method, that would be a state-less non-capturing lambda which just calls the m_context->operator() with provided args. In case of a free function this will simply call m_context with provided args. It is a non-capturing lambda, i.e. lambda which does not require "this" pointer to be called because it has no state - for such a lambda one can take its address and store it (in m_call_with_context) and subsequently use it to call it as a regular function, passing m_context as the first argument. This is a crucial trick: instead of storing the pointer to operator() as a pointer-to-member of Callable, which would require the Function_reference type to depend on Callable, we hide any mention of Callable inside the lambda.
template<typename Return_type , typename... Args>
A crucial context for making a call to the referenced function.
In case of an object's method, that would be the pointer to the object. In case of a free function, this is just the free function itself.