Dune Core Modules (2.4.1)
poolallocator.hh
Go to the documentation of this file.
154 };
264 };
460 static_assert(sizeof(T)<=chunkSize, "Library Error: chunkSize must be able to hold at least one value");
461 static_assert(sizeof(Reference)<=chunkSize, "Library Error: chunkSize must be able to hold at least one reference");
462 static_assert((chunkSize - (alignment - 1)) % alignment == 0, "Library Error: compiler cannot calculate!");
464 static_assert(elements*alignedSize<=chunkSize, "Library Error: aligned elements must fit into chuck!");
472 std::cerr<<"There are still "<<allocated_<<" allocated elements by the Pool<"<<typeid(T).name()<<","<<S<<"> "
This file implements a template class to determine alignment requirements of types at compile time.
An allocator managing a pool of objects for reuse.
Definition: poolallocator.hh:248
Pool< T, size > PoolType
The type of the memory pool we use.
Definition: poolallocator.hh:377
const_pointer address(const_reference x) const
Convert a reference to a pointer.
Definition: poolallocator.hh:360
int max_size() const
Not correctly implemented, yet!
Definition: poolallocator.hh:365
const T & const_reference
The constant reference type.
Definition: poolallocator.hh:284
T value_type
Type of the values we construct and allocate.
Definition: poolallocator.hh:255
@ size
The number of objects to fit into one memory chunk allocated.
Definition: poolallocator.hh:263
PoolAllocator(const PoolAllocator &)
Copy constructor that does not copy the memory pool.
Definition: poolallocator.hh:312
const T * const_pointer
The constant pointer type.
Definition: poolallocator.hh:274
pointer address(reference x) const
Convert a reference to a pointer.
Definition: poolallocator.hh:354
PoolAllocator(const PoolAllocator< U, u > &)
Copy Constructor that does not copy the memory pool.
Definition: poolallocator.hh:305
std::ptrdiff_t difference_type
The difference_type.
Definition: poolallocator.hh:294
@ elements
The number of element each chunk can hold.
Definition: poolallocator.hh:153
@ chunkSize
The size of each chunk memory chunk.
Definition: poolallocator.hh:146
@ unionSize
The size of a union of Reference and MemberType.
Definition: poolallocator.hh:113
@ alignment
The alignment that suits both the MemberType and the Reference (i.e. their least common multiple).
Definition: poolallocator.hh:127
@ size
Size requirement. At least one object has to stored.
Definition: poolallocator.hh:120
T MemberType
The type of object we allocate memory for.
Definition: poolallocator.hh:107
void construct(pointer p, const_reference value)
Construct an object.
Definition: poolallocator.hh:583
void print(std::ostream &os)
Print elements in pool for debugging.
Definition: poolallocator.hh:488
pointer allocate(std::size_t n, const_pointer hint=0)
Allocates objects.
Definition: poolallocator.hh:567
void deallocate(pointer p, std::size_t n)
Free objects.
Definition: poolallocator.hh:576
void destroy(pointer p)
Destroy an object without freeing memory.
Definition: poolallocator.hh:589
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:230
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:252
Statically compute the least common multiple of two integers.
STL namespace.
Get the 'const' version of a reference to a mutable object.
Definition: genericiterator.hh:85
|
Legal Statements / Impressum |
Hosted by TU Dresden |
generated with Hugo v0.111.3
(Nov 12, 23:30, 2024)