From 5b90aba62497a5ded0ed9586da4151e0f09e42a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Tue, 26 Dec 2017 02:18:13 +0100 Subject: [PATCH] ChunkFile: Replace macro with a variable template Note that std::is_trivially_copyable_v cannot be used yet (C++17 only). --- Source/Core/Common/ChunkFile.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h index 0a71bf30cb..43d194c3ac 100644 --- a/Source/Core/Common/ChunkFile.h +++ b/Source/Core/Common/ChunkFile.h @@ -33,10 +33,10 @@ #include "Common/Flag.h" #include "Common/Logging/Log.h" -// ewww - -#define IsTriviallyCopyable(T) \ - std::is_trivially_copyable::type>::value +// XXX: Replace this with std::is_trivially_copyable once we stop using volatile +// on things that are put in savestates, as volatile types are not trivially copyable. +template +constexpr bool IsTriviallyCopyable = std::is_trivially_copyable>::value; // Wrapper class class PointerWrap @@ -155,7 +155,7 @@ public: template void DoArray(T* x, u32 count) { - static_assert(IsTriviallyCopyable(T), "Only sane for trivially copyable types"); + static_assert(IsTriviallyCopyable, "Only sane for trivially copyable types"); DoVoid(x, count * sizeof(T)); } @@ -185,7 +185,7 @@ public: template void Do(T& x) { - static_assert(IsTriviallyCopyable(T), "Only sane for trivially copyable types"); + static_assert(IsTriviallyCopyable, "Only sane for trivially copyable types"); // Note: // Usually we can just use x = **ptr, etc. However, this doesn't work // for unions containing BitFields (long story, stupid language rules)