std::function is allowed to heap allocate in order to hold any necessary bound data in order to execute properly (e.g. lambdas with captures), so this avoids unnecessary reallocating.
std::function is allowed to heap allocate in order to hold any necessary bound data in order to execute properly (e.g. lambdas with captures), so this avoids unnecessary reallocating.