diff options
author | Chris Robinson <[email protected]> | 2023-10-08 20:24:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-10-08 20:24:25 -0700 |
commit | 9cbf4d99231bf495a23cb78be504bd9ffd29eadd (patch) | |
tree | 0f2970407d3841d1317e3157070c9b3a7344bd7b /common/albit.h | |
parent | e805ab9258bea2162bab71e71a2eeddb2be28eeb (diff) |
Avoid std::aligned_storage, it's deprecated in newer C++
Diffstat (limited to 'common/albit.h')
-rw-r--r-- | common/albit.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/albit.h b/common/albit.h index 962eb0aa..82a4a00d 100644 --- a/common/albit.h +++ b/common/albit.h @@ -17,9 +17,9 @@ std::enable_if_t<sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From && std::is_trivially_copyable_v<To>, To> bit_cast(const From &src) noexcept { - std::aligned_storage_t<sizeof(To), alignof(To)> dst; - std::memcpy(&dst, &src, sizeof(To)); - return *std::launder(reinterpret_cast<To*>(&dst)); + alignas(To) char dst[sizeof(To)]; + std::memcpy(&dst[0], &src, sizeof(To)); + return *std::launder(reinterpret_cast<To*>(&dst[0])); } #ifdef __BYTE_ORDER__ |