template <typename T, typename Executor>
class awaitable_frame
contains
alignas(T) unsigned char result_[sizeof(T)];
T get()
{
this->caller_ = nullptr;
this->rethrow_exception();
return std::move(*static_cast<T*>(static_cast<void*>(result_)));
}
~awaitable_frame()
{
if (has_result_)
static_cast<T*>(static_cast<void*>(result_))->~T();
}
But a simple static cast is used into a void and to the T, but the pointer from this does not point to the object, see [basic.life], so you need to std::launder it before using.
contains
But a simple static cast is used into a void and to the T, but the pointer from this does not point to the object, see [basic.life], so you need to std::launder it before using.