|
cppcore
A small, portable C++ core library
|
This class implements the default allocator used by all container classes of the cppcore library. More...
#include <TDefaultAllocator.h>
Public Member Functions | |
| TDefaultAllocator ()=default | |
| The default class constructor. | |
| ~TDefaultAllocator ()=default | |
| The class destructor. | |
| T * | alloc (size_t size) |
| Will allocate the number of insances. | |
| void | release (T *ptr) |
| Will release the last item from the stack. | |
| void | reserve (size_t size) |
| Will prereserve the number of instances. | |
| void | clear () |
| Will clear the whole memory, all used data will be marked as invalid. | |
| size_t | capacity () const |
| Returns the number of allocated instances on the stack. | |
| size_t | reservedMem () const |
| Returns the allocated memory in bytes. | |
| size_t | freeMem () const |
| Returns the free memory in bytes. | |
| void | dumpAllocations (std::string &allocs) |
| Will dump a statistic overview into the given string. | |
This class implements the default allocator used by all container classes of the cppcore library.
Definition at line 37 of file TDefaultAllocator.h.
|
default |
The default class constructor.
Referenced by ~TDefaultAllocator().
|
default |
The class destructor.
References TDefaultAllocator().
|
inline |
Will allocate the number of insances.
| [in] | size | Size of instances to allocate. |
Definition at line 83 of file TDefaultAllocator.h.
|
inline |
Returns the number of allocated instances on the stack.
Definition at line 103 of file TDefaultAllocator.h.
|
inline |
Will clear the whole memory, all used data will be marked as invalid.
Definition at line 98 of file TDefaultAllocator.h.
|
inline |
Will dump a statistic overview into the given string.
| allocs | [inout] The string to hold the allocation statistic. |
Definition at line 118 of file TDefaultAllocator.h.
|
inline |
Returns the free memory in bytes.
Definition at line 113 of file TDefaultAllocator.h.
|
inline |
Will release the last item from the stack.
A basic check will be performed to ensure that it is the correct item.
| ptr | [in] The pointer to validate. |
Definition at line 88 of file TDefaultAllocator.h.
|
inline |
Will prereserve the number of instances.
| [in] | size | NUmber, not used here. |
Definition at line 93 of file TDefaultAllocator.h.
|
inline |
Returns the allocated memory in bytes.
Definition at line 108 of file TDefaultAllocator.h.