mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-10 10:08:51 +00:00
ChunkFile has allowed me to accidentally "Do" a non-POD for the last time!
This commit is contained in:
parent
5c374b2718
commit
385d8e2b15
18 changed files with 43 additions and 30 deletions
|
@ -32,6 +32,7 @@
|
|||
#include <list>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Common.h"
|
||||
#include "FileUtil.h"
|
||||
|
@ -139,11 +140,17 @@ public:
|
|||
template <typename T>
|
||||
void Do(T& x)
|
||||
{
|
||||
// TODO: Bad, Do(some_non_POD) will compile and fail at runtime
|
||||
// type_traits are not fully supported everywhere yet
|
||||
// Ideally this would be std::is_trivially_copyable, but not enough support yet
|
||||
static_assert(std::is_pod<T>::value, "Only sane for POD types");
|
||||
|
||||
DoVoid((void*)&x, sizeof(x));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void DoPOD(T& x)
|
||||
{
|
||||
DoVoid((void*)&x, sizeof(x));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void DoPointer(T*& x, T* const base)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue