diff --git a/websocketpp/common/type_traits.hpp b/websocketpp/common/type_traits.hpp index c89b82b31..f461ef87d 100644 --- a/websocketpp/common/type_traits.hpp +++ b/websocketpp/common/type_traits.hpp @@ -28,6 +28,7 @@ #ifndef WEBSOCKETPP_COMMON_TYPE_TRAITS_HPP #define WEBSOCKETPP_COMMON_TYPE_TRAITS_HPP +#include #include // If we've determined that we're in full C++11 mode and the user hasn't @@ -52,7 +53,18 @@ namespace websocketpp { namespace lib { #ifdef _WEBSOCKETPP_CPP11_TYPE_TRAITS_ - using std::aligned_storage; + // NOTE: this is may not be the best way to detect c++23 compilers, but it worked fine for all test I did + // std::aligned_storage has been depracated as of c++23 (see P1413R3 for more details) + template + struct aligned_storage { +#if __cplusplus >= 202300L + struct type { + alignas(std::max_align_t) unsigned char data[N]; + }; +#else + using type = typename std::aligned_storage::type; +#endif + }; using std::is_same; #else using boost::aligned_storage;