diff --git a/include/Pomdog/Content/Utility/BinaryReader.hpp b/include/Pomdog/Content/Utility/BinaryReader.hpp index 125c7030d..b2dc56731 100644 --- a/include/Pomdog/Content/Utility/BinaryReader.hpp +++ b/include/Pomdog/Content/Utility/BinaryReader.hpp @@ -17,7 +17,8 @@ struct POMDOG_EXPORT BinaryReader final { template static std::vector ReadArray(Stream& stream, std::size_t elementCount) { - static_assert(std::is_pod::value, "You can only use POD types."); + static_assert(std::is_trivially_copyable_v, "You can only use POD types."); + static_assert(std::is_standard_layout_v, "You can only use POD types."); POMDOG_ASSERT(stream); POMDOG_ASSERT(elementCount > 0); @@ -32,7 +33,8 @@ struct POMDOG_EXPORT BinaryReader final { template static std::array ReadArray(Stream& stream) { - static_assert(std::is_pod::value, "You can only use POD types."); + static_assert(std::is_trivially_copyable_v, "You can only use POD types."); + static_assert(std::is_standard_layout_v, "You can only use POD types."); POMDOG_ASSERT(stream); std::array result; @@ -44,7 +46,8 @@ struct POMDOG_EXPORT BinaryReader final { static T Read(Stream& stream) { POMDOG_ASSERT(stream); - static_assert(std::is_pod::value, "You can only use POD types."); + static_assert(std::is_trivially_copyable_v, "You can only use POD types."); + static_assert(std::is_standard_layout_v, "You can only use POD types."); return std::move(ReadArray(stream)[0]); } @@ -58,7 +61,8 @@ struct POMDOG_EXPORT BinaryReader final { static T Read(const std::uint8_t* data) { POMDOG_ASSERT(data); - static_assert(std::is_pod::value, "You can only use POD types."); + static_assert(std::is_trivially_copyable_v, "You can only use POD types."); + static_assert(std::is_standard_layout_v, "You can only use POD types."); T value; std::memcpy(&value, data, sizeof(value)); return value; diff --git a/include/Pomdog/Graphics/ConstantBuffer.hpp b/include/Pomdog/Graphics/ConstantBuffer.hpp index 4fec1513a..50d489d13 100644 --- a/include/Pomdog/Graphics/ConstantBuffer.hpp +++ b/include/Pomdog/Graphics/ConstantBuffer.hpp @@ -47,7 +47,8 @@ class POMDOG_EXPORT ConstantBuffer final { template T GetValue() const { - static_assert(std::is_pod::value, "You can only use plain-old-data types."); + static_assert(std::is_trivially_copyable_v, "You can only use plain-old-data types."); + static_assert(std::is_standard_layout_v, "You can only use plain-old-data types."); T result; Detail::EffectBinaryParameter::Get(*this, result); return std::move(result); @@ -59,7 +60,8 @@ class POMDOG_EXPORT ConstantBuffer final { template void SetValue(const T& value) { - static_assert(std::is_pod::value, "You can only use plain-old-data types."); + static_assert(std::is_trivially_copyable_v, "You can only use plain-old-data types."); + static_assert(std::is_standard_layout_v, "You can only use plain-old-data types."); Detail::EffectBinaryParameter::Set(*this, value); } @@ -67,7 +69,8 @@ class POMDOG_EXPORT ConstantBuffer final { template void SetValue(const T* data, std::size_t count) { - static_assert(std::is_pod::value, "You can only use plain-old-data types."); + static_assert(std::is_trivially_copyable_v, "You can only use plain-old-data types."); + static_assert(std::is_standard_layout_v, "You can only use plain-old-data types."); Detail::EffectBinaryParameter::Set(*this, data, count); } diff --git a/include/Pomdog/Graphics/RenderTarget2D.hpp b/include/Pomdog/Graphics/RenderTarget2D.hpp index 40ca277c9..04b862406 100644 --- a/include/Pomdog/Graphics/RenderTarget2D.hpp +++ b/include/Pomdog/Graphics/RenderTarget2D.hpp @@ -72,7 +72,8 @@ class POMDOG_EXPORT RenderTarget2D final : public Texture { template void GetData(T* result, std::size_t startIndex, std::size_t elementCount) const { - static_assert(std::is_pod_v, "You can only use plain-old-data types."); + static_assert(std::is_trivially_copyable_v, "You can only use plain-old-data types."); + static_assert(std::is_standard_layout_v, "You can only use plain-old-data types."); static_assert(!std::is_void_v); this->GetData(static_cast(result), sizeof(T) * startIndex, sizeof(T) * elementCount); } diff --git a/include/Pomdog/Graphics/detail/EffectBinaryParameter.hpp b/include/Pomdog/Graphics/detail/EffectBinaryParameter.hpp index 74e8c087e..8789c33ce 100644 --- a/include/Pomdog/Graphics/detail/EffectBinaryParameter.hpp +++ b/include/Pomdog/Graphics/detail/EffectBinaryParameter.hpp @@ -21,7 +21,8 @@ void POMDOG_EXPORT Get(const ConstantBuffer& constantBuffer, double& result); template void Get(const ConstantBuffer& constantBuffer, T& result) { - static_assert(std::is_pod::value, "You can only use POD value."); + static_assert(std::is_trivially_copyable_v, "You can only use POD value."); + static_assert(std::is_standard_layout_v, "You can only use POD value."); constantBuffer.GetValue(sizeof(result), static_cast(&result)); } @@ -48,7 +49,8 @@ template void POMDOG_EXPORT Set(ConstantBuffer & constantBuffer, co template void Set(ConstantBuffer& constantBuffer, const T& value) { - static_assert(std::is_pod::value, "You can only use POD value."); + static_assert(std::is_trivially_copyable_v, "You can only use POD value."); + static_assert(std::is_standard_layout_v, "You can only use POD value."); constantBuffer.SetValue(static_cast(&value), sizeof(value)); } diff --git a/include/Pomdog/Math/detail/TaggedArithmetic.hpp b/include/Pomdog/Math/detail/TaggedArithmetic.hpp index f164b59c6..ae154365f 100644 --- a/include/Pomdog/Math/detail/TaggedArithmetic.hpp +++ b/include/Pomdog/Math/detail/TaggedArithmetic.hpp @@ -21,7 +21,8 @@ template class POMDOG_EXPORT TaggedArithmetic final { public: static_assert(std::is_arithmetic::value, "T is arithmetic type."); - static_assert(std::is_pod::value, "T is pod type."); + static_assert(std::is_trivially_copyable_v, "You can only use POD type."); + static_assert(std::is_standard_layout_v, "You can only use POD type."); T value; diff --git a/src/Utility/Tagged.hpp b/src/Utility/Tagged.hpp index ed04a6c7a..6eb4af710 100644 --- a/src/Utility/Tagged.hpp +++ b/src/Utility/Tagged.hpp @@ -12,7 +12,8 @@ namespace Pomdog::Detail { template class POMDOG_EXPORT Tagged final { public: - static_assert(std::is_pod::value, "You can only use plain-old-data types"); + static_assert(std::is_trivially_copyable_v, "You can only use plain-old-data types."); + static_assert(std::is_standard_layout_v, "You can only use plain-old-data types."); typedef T value_type; typedef Tag tag_type; @@ -61,7 +62,8 @@ class POMDOG_EXPORT Tagged final { template Tagged MakeTagged(Arguments&&... arguments) { - static_assert(std::is_pod::value, "You can only use plain-old-data types"); + static_assert(std::is_trivially_copyable_v, "You can only use plain-old-data types."); + static_assert(std::is_standard_layout_v, "You can only use plain-old-data types."); return Tagged(std::forward(arguments)...); }