2015-12-08 04:51:55 +08:00
|
|
|
#pragma once
|
2015-06-22 20:31:26 +08:00
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
#include "allocator.hpp"
|
|
|
|
|
|
|
|
template <class T,
|
|
|
|
typename... Args,
|
|
|
|
class allocator=fast_allocator<T>>
|
|
|
|
T* makeme(Args... args)
|
|
|
|
{
|
|
|
|
allocator alloc;
|
|
|
|
T* mem = alloc.allocate(1);
|
|
|
|
return new (mem) T(args...);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T,
|
|
|
|
class allocator=fast_allocator<T>>
|
|
|
|
void takeme(T* mem)
|
|
|
|
{
|
|
|
|
allocator alloc;
|
|
|
|
mem->~T();
|
|
|
|
alloc.deallocate(mem, 1);
|
|
|
|
}
|