Refuse to compile if alignment of user data cannot be satisfied

This commit is contained in:
Alex Hultman
2019-02-09 23:39:52 +01:00
parent 127d3d6a14
commit b5939da595
+4
View File
@@ -96,6 +96,10 @@ public:
template <class UserData>
TemplatedApp &&ws(std::string pattern, WebSocketBehavior &&behavior) {
/* Don't compile if alignment rules cannot be satisfied */
static_assert(alignof(UserData) <= LIBUS_EXT_ALIGNMENT,
"µWebSockets cannot satisfy UserData alignment requirements. You need to recompile µSockets with LIBUS_EXT_ALIGNMENT adjusted accordingly.");
/* Every route has its own websocket context with its own behavior and user data type */
auto *webSocketContext = WebSocketContext<SSL, true>::create(Loop::defaultLoop(), (us_new_socket_context_t *) httpContext);