![]() |
Blaze 3.9
|
Allocator returning nullptr. More...
#include <NullAllocator.h>
Classes | |
struct | rebind |
Implementation of the NullAllocator rebind mechanism. More... | |
Public Types | |
using | ValueType = T |
Type of the allocated values. | |
using | SizeType = size_t |
Size type of the null allocator. | |
using | DifferenceType = ptrdiff_t |
Difference type of the null allocator. | |
using | value_type = ValueType |
Type of the allocated values. | |
using | size_type = SizeType |
Size type of the null allocator. | |
using | difference_type = DifferenceType |
Difference type of the null allocator. | |
Public Member Functions | |
Constructors | |
NullAllocator ()=default | |
template<typename U > | |
NullAllocator (const NullAllocator< U > &) | |
Conversion constructor from different NullAllocator instances. More... | |
Allocation functions | |
T * | allocate (size_t numObjects) |
Performs no memory allocation and returns nullptr. More... | |
void | deallocate (T *ptr, size_t numObjects) noexcept |
Deallocation of memory. More... | |
Allocator returning nullptr.
The NullAllocator class template represents an implementation of the allocator concept of the standard library and acts as a stand-in for situation where no memory allocation is required. The NullAllocator will never allocate any memory and will always return nullptr.
|
inline |
Conversion constructor from different NullAllocator instances.
allocator | The foreign null allocator to be copied. |
|
inline |
Performs no memory allocation and returns nullptr.
numObjects | The number of objects to be allocated. |
This function does not perform any memory allocation and always returns nullptr.
|
inlinenoexcept |
Deallocation of memory.
ptr | The address of the first element of the array to be deallocated. |
numObjects | The number of objects to be deallocated. |
This function deallocates a junk of memory that was previously allocated via the allocate() function. Note that the argument numObjects must be equal ot the first argument of the call to allocate() that origianlly produced ptr.