|
|
@ -4,26 +4,24 @@ |
|
|
|
#include <type_traits>
|
|
|
|
#include <gp/algorithm/tmp_manip.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace gp{ |
|
|
|
namespace gp { |
|
|
|
template<typename page_allocator = int, size_t align = 1> |
|
|
|
class arena{ |
|
|
|
class arena { |
|
|
|
page_allocator allocator; |
|
|
|
gp::buffer<char> data; |
|
|
|
size_t last; |
|
|
|
size_t count; |
|
|
|
public: |
|
|
|
arena() |
|
|
|
:last(0) |
|
|
|
,count(0) |
|
|
|
,data(gp::buffer<char>(nullptr,nullptr)) |
|
|
|
: last(0) |
|
|
|
, count(0) |
|
|
|
, data(gp::buffer<char>(nullptr,nullptr)) |
|
|
|
{} |
|
|
|
|
|
|
|
arena(size_t sz) |
|
|
|
:last(0) |
|
|
|
,count(0) |
|
|
|
,data(nullptr,nullptr) |
|
|
|
: last(0) |
|
|
|
, count(0) |
|
|
|
, data(nullptr,nullptr) |
|
|
|
{ |
|
|
|
if constexpr (gp::has_allocator_interface<page_allocator>::value) |
|
|
|
{ |
|
|
@ -39,11 +37,10 @@ namespace gp{ |
|
|
|
} |
|
|
|
|
|
|
|
arena(char* pos,size_t sz) |
|
|
|
:last(0) |
|
|
|
,count(0) |
|
|
|
,data(pos,pos+sz) |
|
|
|
{ |
|
|
|
} |
|
|
|
: last(0) |
|
|
|
, count(0) |
|
|
|
, data(pos,pos+sz) |
|
|
|
{} |
|
|
|
|
|
|
|
void* allocate(size_t sz) |
|
|
|
{ |
|
|
@ -98,4 +95,4 @@ namespace gp{ |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |