NULL allocator. More...
Public Types | |
typedef AllocatorBase< T > ::value_type | value_type |
typedef AllocatorBase< T > ::size_type | size_type |
typedef AllocatorBase< T > ::difference_type | difference_type |
typedef AllocatorBase< T >::pointer | pointer |
typedef AllocatorBase< T > ::const_pointer | const_pointer |
typedef AllocatorBase< T > ::reference | reference |
typedef AllocatorBase< T > ::const_reference | const_reference |
Public Member Functions | |
pointer | allocate (size_type n, const void *unused=NULL) |
void | deallocate (void *p, size_type n) |
size_type | max_size () const |
Returns the maximum number of elements the allocator can provide. | |
pointer | address (reference r) const |
const_pointer | address (const_reference r) const |
void | construct (pointer p, const T &val) |
template<typename U , typename... Args> | |
void | construct (U *ptr, Args &&...args) |
Constructs a new U using variadic arguments. | |
void | destroy (pointer p) |
template<typename U > | |
void | destroy (U *ptr) |
Destroys an U constructed with variadic arguments. |
NULL allocator.
T | class or type |
A NullAllocator is useful for fixed-size, stack based allocations (i.e., static arrays used by FixedSizeAllocatorWithCleanup).
A NullAllocator always returns 0 for max_size(), and always returns NULL for allocation requests. Though the allocator does not allocate at runtime, it does perform a secure wipe or zeroization during cleanup.
Definition at line 253 of file secblock.h.
size_type NullAllocator< T >::max_size | ( | ) | const [inline] |
Returns the maximum number of elements the allocator can provide.
Internally, preprocessor macros are used rather than std::numeric_limits because the latter is not a constexpr. Some compilers, like Clang, do not optimize it well under all circumstances. Compilers like GCC, ICC and MSVC appear to optimize it well in either form.
Reimplemented from AllocatorBase< T >.
Definition at line 273 of file secblock.h.
void AllocatorBase< T >::construct | ( | U * | ptr, | |
Args &&... | args | |||
) | [inline, inherited] |
Constructs a new U using variadic arguments.
U | the type to be forwarded | |
Args | the arguments to be forwarded |
ptr | pointer to type U | |
args | variadic arguments |
This is a C++11 feature. It is available when CRYPTOPP_CXX11_VARIADIC_TEMPLATES is defined. The define is controlled by compiler versions detected in config.h.
Definition at line 67 of file secblock.h.
void AllocatorBase< T >::destroy | ( | U * | ptr | ) | [inline, inherited] |
Destroys an U constructed with variadic arguments.
U | the type to be forwarded |
This is a C++11 feature. It is available when CRYPTOPP_CXX11_VARIADIC_TEMPLATES is defined. The define is controlled by compiler versions detected in config.h.
Definition at line 74 of file secblock.h.