Skip to content

Instantly share code, notes, and snippets.

View Asirias's full-sized avatar

pellmell Asirias

View GitHub Profile
namespace MemoryPool { 
template <class T, std::size_t Size> class MyMemoryPool final{ 
using selfMemoryPtr =  MyMemoryPool<T, Size>*; 
public:  
inline MyMemoryPool() : next(nullptr) { expandFreemem(Size); }  
inline virtual ~MyMemoryPool() {   
for (selfMemoryPtr nextPtr = next; nextPtr != 0; nextPtr = next) {
next = next->next;    
std::free(nextPtr);   
}  
#include <Windows.h>#include <crtdbg.h>#include <stdio.h>#include <time.h>#include <assert.h>#ifndef FALSE#define FALSE               0#endif#ifndef TRUE#define TRUE                1#endif#if defined(_DEBUG) && !defined(NEW)#define NEW  ::new(_NORMAL_BLOCK, __FILE__, __LINE__)#else#define NEW  new#define MALLOC(memsize) malloc(memsize)#endif#define EnableWriteErrorLog#if defined(EnableWriteErrorLog) && defined(_DEBUG)extern int ResetErrorLog(void);extern void WriteErrorLog(const char szFunction[], const char szComment[], const unsigned long uCnt);extern void WriteErrorLog(const char szFunction[], const char szComment[]);extern void WriteErrorLog(const char szFile[], const char szFunction[], const unsigned line, const char szComment[], const unsigned long uCnt);extern void WriteErrorLog(const char szFile[], const char szFunction[], const unsigned line, const char szComment[]);extern void memory_leaks_LOG();#define ErrorLog(log) WriteErrorLog(__FILE__,__FUNCTION__, __LINE__,log)#else#pragma warning(disable: 400
#include "Singleton.h"
class Test1 final:
public singleton::Singleton<Test1>{
public: 
//明示的コンストラクタを最初に呼ぶ 
explicit inline Test1() : Num(0){} 
// デストラクタ 
inline ~Test1() throw(){} 
inline int GetNum() const throw(){  return Num; } 
void CountNum(){  Num++; }
#pragma once
namespace singleton{ 
class Uncopyable { 
protected:  
explicit inline Uncopyable() throw(){}  
virtual inline ~Uncopyable() throw(){} 
private:  
inline Uncopyable(const Uncopyable & right) throw();  
inline Uncopyable & operator=(const Uncopyable & right) throw();
}; 
#include "DXUT.h"
#include <wincrypt.h>
#pragma warning (disable : 4127)
#pragma warning (disable : 4512)
#include <msgpack.hpp>
#include <map>
using namespace std;
#pragma comment(lib, "crypt32.lib")
#define KEYLENGTH_128   0x0080 * 0x10000       
// 128-bit長
#pragma once
#ifndef __Serialize__
#define __Serialize__
struct SaveData;
class Serialize{
private: 
// ファイル名 
const char* const FileName = "save.dat";
// 暗号化するパスワード
const char* const password = "パスワード";