37 template <
class TFunction>
38 Function(TFunction&& function)
noexcept;
41 Function& operator=(std::nullptr_t)
noexcept;
44 template <
typename TFunction>
46 template <
typename TFunction>
50 explicit operator bool() const noexcept {
return (_manager !=
nullptr); }
53 R operator()(Args... args);
57 template <
class UR,
class... UArgs,
size_t UCapacity>
58 friend void swap(
Function<UR(UArgs...), UCapacity>& function1,
Function<UR(UArgs...), UCapacity>& function2)
noexcept;
61 enum class Operation { Clone, Destroy };
63 using Invoker = R (*)(
void*, Args&&...);
64 using Manager = void (*)(
void*,
void*, Operation);
66 static const size_t StorageSize = Capacity -
sizeof(Invoker) -
sizeof(Manager);
67 static const size_t StorageAlign = 8;
69 alignas(StorageAlign) std::byte _data[StorageSize];
73 template <
typename TFunction>
74 static R Invoke(
void* data, Args&&... args)
noexcept;
76 template <
typename TFunction>
77 static void Manage(
void* dst,
void* src, Operation op)
noexcept;