Problems with std::function:-
1. It can not hold move only callable objects.
2. It heap allocate stored callable object if the object is large enough.
1. It can not hold move only callable objects.
2. It heap allocate stored callable object if the object is large enough.
4. Can't be constexpr
Example: https://github.com/facebook/folly/blob/main/folly/docs/Funct...