Crypto++ 8.7
Free C++ class library of cryptographic schemes
|
Base class for all allocators used by SecBlock. More...
#include <secblock.h>
Public Types | |
typedef T | value_type |
typedef size_t | size_type |
typedef std::ptrdiff_t | difference_type |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef T & | reference |
typedef const T & | const_reference |
Public Member Functions | |
pointer | address (reference r) const |
const_pointer | address (const_reference r) const |
void | construct (pointer p, const T &val) |
void | destroy (pointer p) |
size_type | max_size () const |
Returns the maximum number of elements the allocator can provide. More... | |
template<typename V , typename... Args> | |
void | construct (V *ptr, Args &&... args) |
Constructs a new V using variadic arguments. More... | |
template<typename V > | |
void | destroy (V *ptr) |
Destroys an V constructed with variadic arguments. More... | |
Static Public Attributes | |
static const size_type | ELEMS_MAX = ... |
Returns the maximum number of elements the allocator can provide. More... | |
Base class for all allocators used by SecBlock.
T | the class or type |
Definition at line 29 of file secblock.h.
typedef T AllocatorBase< T >::value_type |
Definition at line 32 of file secblock.h.
typedef size_t AllocatorBase< T >::size_type |
Definition at line 33 of file secblock.h.
typedef std::ptrdiff_t AllocatorBase< T >::difference_type |
Definition at line 34 of file secblock.h.
typedef T* AllocatorBase< T >::pointer |
Definition at line 35 of file secblock.h.
typedef const T* AllocatorBase< T >::const_pointer |
Definition at line 36 of file secblock.h.
typedef T& AllocatorBase< T >::reference |
Definition at line 37 of file secblock.h.
typedef const T& AllocatorBase< T >::const_reference |
Definition at line 38 of file secblock.h.
|
inline |
Definition at line 40 of file secblock.h.
|
inline |
Definition at line 41 of file secblock.h.
|
inline |
Definition at line 42 of file secblock.h.
|
inline |
Definition at line 43 of file secblock.h.
|
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.
Definition at line 73 of file secblock.h.
|
inline |
Constructs a new V using variadic arguments.
V | the type to be forwarded |
Args | the arguments to be forwarded |
ptr | pointer to type V |
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 91 of file secblock.h.
Destroys an V constructed with variadic arguments.
V | 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 98 of file secblock.h.
|
static |
Returns the maximum number of elements the allocator can provide.
ELEMS_MAX
is the maximum number of elements the Allocator
can provide. The value of ELEMS_MAX
is SIZE_MAX/sizeof(T)
. std::numeric_limits
was avoided due to lack of constexpr
-ness in C++03 and below.
ELEMS_MAX
is a static data member of type size_type
. In C++11 and above ELEMS_MAX
is an enum
inheriting from size_type
. In both cases ELEMS_MAX
can be used before objects are fully constructed, and it does not suffer the limitations of class methods like max_size
. Definition at line 58 of file secblock.h.