#ifndef RAII_DEFAULT_ALLOCATOR_HPP #define RAII_DEFAULT_ALLOCATOR_HPP #include //size_t #include //memcpy #include namespace raii{ namespace detail{ template struct default_allocator { static void free(void* data){ ::operator delete(data, std::align_val_t{Alignment}); } static void* allocate(size_t size){ return ::operator new(size, std::align_val_t{Alignment}); } static void* copy(const void* c, size_t size){ char* tmp = reinterpret_cast(allocate(size)); memcpy(tmp, c, size); return tmp; } }; } } #endif