aboutsummaryrefslogtreecommitdiffstats
path: root/core/async_event.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-05-24 11:56:56 -0700
committerChris Robinson <[email protected]>2023-05-24 11:56:56 -0700
commitf3e9d066df50a6e77e8c15ea97b195a4b069f254 (patch)
tree1823b869dd881b1c46243ba3e653979d210caba6 /core/async_event.h
parentda56dd074595d6590273eeb1739f1c9bfc1b5fee (diff)
Be a bit more safe with type mangling
Diffstat (limited to 'core/async_event.h')
-rw-r--r--core/async_event.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/async_event.h b/core/async_event.h
index 9e2d1193..c049fa02 100644
--- a/core/async_event.h
+++ b/core/async_event.h
@@ -54,7 +54,11 @@ using AsyncEvent = std::variant<AsyncKillThread,
AsyncDisconnectEvent>;
template<typename T, typename ...Args>
-auto &InitAsyncEvent(AsyncEvent *evt, Args&& ...args)
-{ return std::get<T>(*al::construct_at(evt, std::in_place_type<T>, std::forward<Args>(args)...)); }
+auto &InitAsyncEvent(std::byte *evtbuf, Args&& ...args)
+{
+ auto *evt = al::construct_at(reinterpret_cast<AsyncEvent*>(evtbuf), std::in_place_type<T>,
+ std::forward<Args>(args)...);
+ return std::get<T>(*evt);
+}
#endif