Skip to content

Commit

Permalink
ChunkFile: Replace macro with a variable template
Browse files Browse the repository at this point in the history
Note that std::is_trivially_copyable_v cannot be used yet (C++17 only).
  • Loading branch information
leoetlino committed May 30, 2018
1 parent 8a00a9e commit 5b90aba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Source/Core/Common/ChunkFile.h
Expand Up @@ -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
Expand Down Expand Up @@ -155,7 +155,7 @@ class PointerWrap
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));
}

Expand Down Expand Up @@ -185,7 +185,7 @@ class PointerWrap
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)
Expand Down

0 comments on commit 5b90aba

Please sign in to comment.