WinStd Windows Win32 API using Standard C++

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
winstd::heap_allocator< _Ty > Class Template Reference
Windows API

HeapAlloc allocator. More...

`#include <WinStd/Win.h>`

## Classes
struct | rebind
| A structure that enables an allocator for objects of one type to allocate storage for objects of another type. More...

## Public Types
typedef _Ty | value_type
| A type that is managed by the allocator.
typedef _Ty * | pointer
| A type that provides a pointer to the type of object managed by the allocator.
typedef _Ty & | reference
| A type that provides a reference to the type of object managed by the allocator.
typedef const _Ty * | const_pointer
| A type that provides a constant pointer to the type of object managed by the allocator.
typedef const _Ty & | const_reference
| A type that provides a constant reference to type of object managed by the allocator.
typedef SIZE_T | size_type
| An unsigned integral type that can represent the length of any sequence that an object of template class `heap_allocator` can allocate.
typedef ptrdiff_t | difference_type
| A signed integral type that can represent the difference between values of pointers to the type of object managed by the allocator.

## Public Member Functions
| heap_allocator (HANDLE heap)
| Constructs allocator.
template<class _Other >
| heap_allocator (const heap_allocator< _Other > &other)
| Constructs allocator from another type.
pointer | allocate (size_type count)
| Allocates a new memory block.
void | deallocate (pointer ptr, size_type size)
| Frees memory block.
void | construct (pointer ptr, const _Ty &val)
| Calls copying constructor for the element.
void | construct (pointer ptr, _Ty &&val)
| Calls moving constructor for the element.
void | destroy (pointer ptr)
| Calls destructor for the element.
size_type | max_size () const
| Returns maximum memory block size.

## Public Attributes
HANDLE | m_heap
| Heap handle.

## Detailed Description

template<class _Ty>
class winstd::heap_allocator< _Ty >

HeapAlloc allocator.

## Constructor & Destructor Documentation

## ◆ heap_allocator() [1/2]

template<class _Ty >

winstd::heap_allocator< _Ty >::heap_allocator | ( | HANDLE | heap | ) |
| inline

Constructs allocator.

Parameters

  [in] | heap | Handle to existing heap

## ◆ heap_allocator() [2/2]

template<class _Ty >
template<class _Other >

winstd::heap_allocator< _Ty >::heap_allocator | ( | const heap_allocator< _Other > & | other | ) |
| inline

Constructs allocator from another type.

Parameters

  [in] | other | Another allocator of the heap_allocator kind

## Member Function Documentation

## ◆ allocate()

template<class _Ty >

pointer winstd::heap_allocator< _Ty >::allocate | ( | size_type | count | ) |
| inline

Allocates a new memory block.

Parameters

  [in] | count | Number of elements

Returns
  Pointer to new memory block

## ◆ construct() [1/2]

template<class _Ty >

void winstd::heap_allocator< _Ty >::construct | ( | pointer | ptr,
|  | _Ty && | val )
| inline

Calls moving constructor for the element.

Parameters

  [in] | ptr | Pointer to memory block
  [in] | val | Source element

## ◆ construct() [2/2]

template<class _Ty >

void winstd::heap_allocator< _Ty >::construct | ( | pointer | ptr,
|  | const _Ty & | val )
| inline

Calls copying constructor for the element.

Parameters

  [in] | ptr | Pointer to memory block
  [in] | val | Source element

## ◆ deallocate()

template<class _Ty >

void winstd::heap_allocator< _Ty >::deallocate | ( | pointer | ptr,
|  | size_type | size )
| inline

Frees memory block.

Parameters

  [in] | ptr | Pointer to memory block
  [in] | size | Size of memory block (in bytes)

## ◆ destroy()

template<class _Ty >

void winstd::heap_allocator< _Ty >::destroy | ( | pointer | ptr | ) |
| inline

Calls destructor for the element.

Parameters

  [in] | ptr | Pointer to memory block

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

- include/WinStd/Win.h