89inline Interface*
makeDelegate(StorageType& aligned_new_memory,
const Interface* to_copy) {
90 const Implementation* copy_me =
reinterpret_cast<const Implementation*
>(to_copy);
92 static_assert(std::is_base_of<Interface, Implementation>::value,
"Implementation must derive from Interface");
93 static_assert(
sizeof(Implementation) <=
sizeof(aligned_new_memory),
"Handle size not large enough");
94 static_assert((
FW_HANDLE_ALIGNMENT %
alignof(Implementation)) == 0,
"Handle alignment invalid");
96 Implementation*
interface = nullptr;
97 if (to_copy ==
nullptr) {
98 interface = new (aligned_new_memory) Implementation;
100 interface = new (aligned_new_memory) Implementation(*copy_me);