cast_util: Remove unnecessary typename

Given we use std::aligned_storage_t, we don't need to specify
typename here. If we used std::aligned_storage, then we would need to.
This commit is contained in:
Lioncash 2018-07-15 19:06:47 -04:00 committed by MerryMage
parent 89e43867c1
commit 9f8a44c982

View file

@ -18,7 +18,7 @@ inline Dest BitCast(const Source& source) {
static_assert(std::is_trivially_copyable_v<Dest>, "destination type must be trivially copyable.");
static_assert(std::is_trivially_copyable_v<Source>, "source type must be trivially copyable");
typename std::aligned_storage_t<sizeof(Dest), alignof(Dest)> dest;
std::aligned_storage_t<sizeof(Dest), alignof(Dest)> dest;
std::memcpy(&dest, &source, sizeof(dest));
return reinterpret_cast<Dest&>(dest);
}
@ -30,7 +30,7 @@ inline Dest BitCastPointee(const SourcePtr source) {
static_assert(sizeof(SourcePtr) == sizeof(void*), "source pointer must have size of a pointer");
static_assert(std::is_trivially_copyable_v<Dest>, "destination type must be trivially copyable.");
typename std::aligned_storage_t<sizeof(Dest), alignof(Dest)> dest;
std::aligned_storage_t<sizeof(Dest), alignof(Dest)> dest;
std::memcpy(&dest, BitCast<void*>(source), sizeof(dest));
return reinterpret_cast<Dest&>(dest);
}