|
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
21 #ifndef ELM_ALLOC_BLOCKALLOCATOR_H_
22 #define ELM_ALLOC_BLOCKALLOCATOR_H_
24 #include <elm/alloc/StackAllocator.h>
25 #include <elm/compare.h>
33 typedef struct block_t {
41 : alloc(
min(sizeof(T), sizeof(block_t)) * block_per_chunk), list(0) { }
47 return reinterpret_cast<T *
>(res);
50 return reinterpret_cast<T *
>(alloc.
allocate(
sizeof(T)));
54 block_t *b =
reinterpret_cast<block_t *
>(
p);
Printable< T, M > p(const T &data, const M &man)
Definition: Output.h:302
Definition: StackAllocator.h:34
static const int default_block_per_chunk
Definition: BlockAllocator.h:38
const T & min(const T &x, const T &y)
Definition: compare.h:104
void free(T *p)
Definition: BlockAllocator.h:53
Definition: BlockAllocator.h:31
T * allocate()
Definition: BlockAllocator.h:43
BlockAllocator(int block_per_chunk=default_block_per_chunk)
Definition: BlockAllocator.h:40
void * allocate(t::size size)
Definition: alloc_StackAllocator.cpp:75