summaryrefslogtreecommitdiff
path: root/Source/Core/Common/ChunkFile.h
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2017-12-26 02:18:13 +0100
committerLéo Lam <leo@innovatetechnologi.es>2018-05-30 11:39:30 +0200
commit5b90aba62497a5ded0ed9586da4151e0f09e42a0 (patch)
treeb4631c224ae996933cb62b871761b31ac3c69937 /Source/Core/Common/ChunkFile.h
parent8a00a9e1497c75b3cff7247bd6e86280ab9c85b5 (diff)
ChunkFile: Replace macro with a variable template
Note that std::is_trivially_copyable_v cannot be used yet (C++17 only).
Diffstat (limited to 'Source/Core/Common/ChunkFile.h')
-rw-r--r--Source/Core/Common/ChunkFile.h12
1 files 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<typename std::remove_volatile<T>::type>::value
+// XXX: Replace this with std::is_trivially_copyable<T> once we stop using volatile
+// on things that are put in savestates, as volatile types are not trivially copyable.
+template <typename T>
+constexpr bool IsTriviallyCopyable = std::is_trivially_copyable<std::remove_volatile_t<T>>::value;
// Wrapper class
class PointerWrap
@@ -155,7 +155,7 @@ public:
template <typename T>
void DoArray(T* x, u32 count)
{
- static_assert(IsTriviallyCopyable(T), "Only sane for trivially copyable types");
+ static_assert(IsTriviallyCopyable<T>, "Only sane for trivially copyable types");
DoVoid(x, count * sizeof(T));
}
@@ -185,7 +185,7 @@ public:
template <typename T>
void Do(T& x)
{
- static_assert(IsTriviallyCopyable(T), "Only sane for trivially copyable types");
+ static_assert(IsTriviallyCopyable<T>, "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)