Here are the list of customisation points I'd like on an erased function abstraction:
- inplace buffer size, and exceed policy (concept failure vs defer to allocator), alignment
- allocator
- move only/copyable/non-relocatable
- nullability, non nullables can assume the function object is set instead of checking and throwing (can kind of already achieve this with __builtin_unreachable)
- trivially relocatable, so that the function object can be passed around by value
- noexcept on constructor and call operator, and copy/move (latter can be made part of the signature)
- owning vs non-owning (function ref vs other)
- overload sets
As long as there are differing requirements, people are going to want different sets of these so it'd be nice if we can just capture all of the above in a single abstraction via a policy set passed as a trait.
Would be nice if compatible policy sets also allowed implicit conversion (in the direction of relaxing requirements). E.g. trivial -> non trivial, conversion to object with larger SBO, copyable+moveable to move only, etc. Enabling this conversion may also be a trait people want to configure.