Merge pull request #10737 from Tilka/alignas

Common: replace std::aligned_storage_t with alignas
This commit is contained in:
JosJuice 2022-06-13 18:11:48 +02:00 committed by GitHub
commit 82b0098c3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -201,7 +201,7 @@ inline To BitCast(const From& source) noexcept
static_assert(std::is_trivially_copyable<To>(), static_assert(std::is_trivially_copyable<To>(),
"BitCast destination type must be trivially copyable."); "BitCast destination type must be trivially copyable.");
std::aligned_storage_t<sizeof(To), alignof(To)> storage; alignas(To) std::byte storage[sizeof(To)];
std::memcpy(&storage, &source, sizeof(storage)); std::memcpy(&storage, &source, sizeof(storage));
return reinterpret_cast<To&>(storage); return reinterpret_cast<To&>(storage);
} }