chsvlib
chsv helper source code
raw_delete_t< element_t > Struct Template Reference

A type of a deleter object used with smart pointers to a raw memory block allocated using the global ::operator new function. When the managed memory is released these smart pointers call ::operator delete to perform the cleanup. More...

#include <chsvmem.h>

Classes

struct  rebind
 Defines an instance of the deleter template for other types of values. More...
 

Public Member Functions

 raw_delete_t ()=default
 Default constructor.
 
 raw_delete_t (const raw_delete_t &)=default
 Copy constructor.
 
 raw_delete_t (raw_delete_t &&)=default
 Move constructor.
 
template<class U >
 raw_delete_t (const raw_delete_t< U > &)
 
template<class U >
 raw_delete_t (raw_delete_t< U > &&)
 
void operator() (element_t *ptr)
 Deleting operator.
 

Detailed Description

template<class element_t>
struct Chusov::Memory::raw_delete_t< element_t >

A type of a deleter object used with smart pointers to a raw memory block allocated using the global ::operator new function. When the managed memory is released these smart pointers call ::operator delete to perform the cleanup.

Template Parameters
element_tis a type of an element which the managed pointers point to.

Example:

using namespace Chusov::Memory;
struct data_t
{
unsigned header;
size_t size;
unsigned chat first_byte;
};
std::unique_ptr<data_t, raw_delete_t<data_t>> void* Allocate(size_t cb)
{
return std::unique_ptr<data_t, raw_delete_t<data_t>> (static_cast<data_t*> (::operator new(sizeof(data_t) - offsetof(data_t, first_byte) + cb)));
}
The file provides interfaces manage memory.
A namespace of functions and components used to work with memory.
Definition: chsvmem.h:71
Examples
chsvwinutilex\CreateDACL.cpp.

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