chsvlib
chsv helper source code
allocator< T > Struct Template Reference

A class template implementing behavior of the standard allocator interface using the memory management functions of the Chusov::Memory namespace. More...

#include <chsvmemex.h>

Inheritance diagram for allocator< T >:

Classes

struct  rebind
 

Public Types

typedef T value_type
 A type of an element managed by the allocator.
 
typedef T * pointer
 A type of a pointer to an element managed by the allocator.
 
typedef const T * const_pointer
 A type of a constant pointer to an element managed by the allocator.
 
typedef T & reference
 A type of a reference to an element managed by the allocator.
 
typedef const T & const_reference
 A type of a constant reference to an element managed by the allocator.
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 A type of an integer value specifying difference between two pointers to memory, managed by the allocator.
 
typedef std::true_type propagate_on_container_move_assignment
 Allows movement.
 

Public Member Functions

 allocator ()=default
 A compiler-generated default constructor. More...
 
 allocator (const allocator< T > &refRight)=default
 Compiler-generated copy constructor. More...
 
template<class U >
 allocator (const allocator< U > &refRight) noexcept
 A copy constructor called over the allocator object of type, that is another instantiation of the Chusov::Memory::allocator template. More...
 
pointer address (reference obj) const noexcept
 Returns an address of an object, passed, by reference, as a parameter. More...
 
const_pointer address (const_reference obj) const noexcept
 Returns an address of an object, passed, by reference, as a parameter. More...
 
pointer allocate (size_type n, allocator< void >::const_pointer=0)
 Allocates an uninitialized memory to hold the specified number of objects of the type T. More...
 
void deallocate (pointer p, size_type)
 Deallocates a pointed memory. More...
 
size_type max_size () const noexcept
 Returns a maximum number of objects of the T type, that can be allocated theoretically, that is SIZE_MAX / sizeof(T).
 
template<class U , class ... arg_t>
void construct (U *p, arg_t &&...args)
 
template<class U >
void destroy (U *p)
 Destroys an object, pointed to by the parameter. The method does not deallocate the occupied memory, as it is performed by the deallocate method. More...
 

Detailed Description

template<class T>
struct Chusov::Memory::allocator< T >

A class template implementing behavior of the standard allocator interface using the memory management functions of the Chusov::Memory namespace.

Template Parameters
Tis a type of an element kept in memory managed by the allocator. The default instantiation of the template is stateless.
Remarks
Use secure_allocator allocator class to manage memory keeping sensitive data.
See also
AllocateData;
FreeData.

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