35 #ifndef _UTILS_ALLOCATORS_HPP_INCLUDED
36 #define _UTILS_ALLOCATORS_HPP_INCLUDED
51 void*
alloc( std::size_t nofBytes);
67 std::size_t
alloc( std::size_t nofBytes);
82 template <
typename Type>
97 if (idx >
size()/
sizeof(Type))
99 throw std::logic_error(
"Array bounds access");
106 if (idx >
size()/
sizeof(Type))
108 throw std::logic_error(
"Array bounds access");
113 std::size_t
alloc(
unsigned int nof)
115 std::size_t mm = nof *
sizeof(Type);
116 if (mm < nof)
throw std::bad_alloc();
118 return idx /
sizeof(Type);
~GreedySmallChunkAllocator()
Type & operator[](std::size_t idx)
Definition: allocators.hpp:104
Definition: allocators.hpp:73
GreedySmallChunkAllocator()
const void * base() const
Definition: allocators.hpp:68
Interface for an allocator implemented with the strategy of array doubling.
Definition: allocators.hpp:61
std::size_t m_pos
Definition: allocators.hpp:76
MemChunk * m_chunk
Definition: allocators.hpp:54
Interface for an allocator for small chunks without a free. Memory is freed in the destructor of the ...
Definition: allocators.hpp:46
Interface for an array doubling allocator that allocates only one fixed size type of element...
Definition: allocators.hpp:83
void * base()
Definition: allocators.hpp:69
std::size_t size() const
Definition: allocators.hpp:70
std::size_t m_size
Definition: allocators.hpp:75
void * alloc(std::size_t nofBytes)
const Type & operator[](std::size_t idx) const
Definition: allocators.hpp:95
~ArrayDoublingAllocator()
std::size_t alloc(unsigned int nof)
Definition: allocators.hpp:113
char * m_ar
Definition: allocators.hpp:74
const Type * base() const
Definition: allocators.hpp:85
std::size_t alloc(std::size_t nofBytes)
Type * base()
Definition: allocators.hpp:90