Fabcoin Core  0.16.2
P2P Digital Currency
Public Types | Public Member Functions | Static Protected Member Functions | List of all members
AllocatorBase< T > Class Template Reference

Base class for all allocators used by SecBlock. More...

#include <secblock.h>

Inheritance diagram for AllocatorBase< T >:
[legend]

Public Types

typedef T value_type
 
typedef size_t size_type
 
typedef std::ptrdiff_t difference_type
 
typedef Tpointer
 
typedef const Tconst_pointer
 
typedef Treference
 
typedef const Tconst_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)
 
CRYPTOPP_CONSTEXPR size_type max_size () const
 Returns the maximum number of elements the allocator can provide. More...
 

Static Protected Member Functions

static void CheckSize (size_t size)
 Verifies the allocator can satisfy a request based on size. More...
 

Detailed Description

template<class T>
class AllocatorBase< T >

Base class for all allocators used by SecBlock.

Template Parameters
Tthe class or type

Definition at line 29 of file secblock.h.

Member Typedef Documentation

template<class T>
typedef const T* AllocatorBase< T >::const_pointer

Definition at line 40 of file secblock.h.

template<class T>
typedef const T& AllocatorBase< T >::const_reference

Definition at line 42 of file secblock.h.

template<class T>
typedef std::ptrdiff_t AllocatorBase< T >::difference_type

Definition at line 37 of file secblock.h.

template<class T>
typedef T* AllocatorBase< T >::pointer

Definition at line 39 of file secblock.h.

template<class T>
typedef T& AllocatorBase< T >::reference

Definition at line 41 of file secblock.h.

template<class T>
typedef size_t AllocatorBase< T >::size_type

Definition at line 33 of file secblock.h.

template<class T>
typedef T AllocatorBase< T >::value_type

Definition at line 32 of file secblock.h.

Member Function Documentation

template<class T>
pointer AllocatorBase< T >::address ( reference  r) const
inline

Definition at line 44 of file secblock.h.

template<class T>
const_pointer AllocatorBase< T >::address ( const_reference  r) const
inline

Definition at line 45 of file secblock.h.

template<class T>
static void AllocatorBase< T >::CheckSize ( size_t  size)
inlinestaticprotected

Verifies the allocator can satisfy a request based on size.

Parameters
sizethe size of the allocation, in elements
Exceptions
InvalidArgument

CheckSize verifies the number of elements requested is valid.

If size is greater than max_size(), then InvalidArgument is thrown. The library throws InvalidArgument if the size is too large to satisfy.

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.

Note
size is the count of elements, and not the number of bytes

Definition at line 91 of file secblock.h.

Here is the caller graph for this function:

template<class T>
void AllocatorBase< T >::construct ( pointer  p,
const T val 
)
inline

Definition at line 46 of file secblock.h.

template<class T>
void AllocatorBase< T >::destroy ( pointer  p)
inline

Definition at line 47 of file secblock.h.

template<class T>
CRYPTOPP_CONSTEXPR size_type AllocatorBase< T >::max_size ( ) const
inline

Returns the maximum number of elements the allocator can provide.

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 55 of file secblock.h.


The documentation for this class was generated from the following file: