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

A class template redefining the behavior of the Chusov::Memory::allocator class template so that the deallocation function randomizes the memory before the deallocation. More...

#include <chsvmemex.h>

Inheritance diagram for secure_allocator< T >:
Collaboration diagram for secure_allocator< T >:

Public Member Functions

 secure_allocator ()=default
 A compiler-generated default constructor. More...
 
 secure_allocator (const secure_allocator< T > &refRight)=default
 Compiler-generated copy constructor. More...
 
template<class U >
 secure_allocator (const secure_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...
 
void deallocate (typename allocator< T >::pointer p, typename allocator< T >::size_type n)
 Randomizes and deallocates a pointed memory. More...
 
- Public Member Functions inherited from allocator< T >
 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...
 

Additional Inherited Members

- Public Types inherited from allocator< T >
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.
 

Detailed Description

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

A class template redefining the behavior of the Chusov::Memory::allocator class template so that the deallocation function randomizes the memory before the deallocation.

Template Parameters
Tis a type of an element kept in memory managed by the allocator.
Remarks
Use allocator allocator class to manage memory that does not keep sensitive data. This will help avoiding unnecessary performance overhead introduced by the randomizing.
See also
AllocateData;
SecureFreeData.

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