| description | Learn more about: MakeAllocator Class | |||||
|---|---|---|---|---|---|---|
| title | MakeAllocator Class | |||||
| ms.date | 10/03/2018 | |||||
| ms.topic | reference | |||||
| f1_keywords |
|
|||||
| helpviewer_keywords |
|
|||||
| ms.assetid | a1114615-abd7-4a56-9bc3-750c118f0fa1 |
Supports the WRL infrastructure and is not intended to be used directly from your code.
template<
typename T,
bool hasWeakReferenceSupport =
!__is_base_of(RuntimeClassFlags<InhibitWeakReference>,
T)
>
class MakeAllocator;
template<typename T>
class MakeAllocator<T, false>;
template<typename T>
class MakeAllocator<T, true>;T
A type name.
hasWeakReferenceSupport
true to allocate memory for an object that supports weak references; false to allocate memory for an object that doesn't support weak references.
Allocates memory for an activatable class, with or without weak reference support.
Override the MakeAllocator class to implement a user-defined memory allocation model.
MakeAllocator is typically used to prevent memory leaks if an object throws during construction.
| Name | Description |
|---|---|
| MakeAllocator::MakeAllocator | Initializes a new instance of the MakeAllocator class. |
| MakeAllocator::~MakeAllocator | Deinitializes the current instance of the MakeAllocator class. |
| Name | Description |
|---|---|
| MakeAllocator::Allocate | Allocates memory and associates it with the current MakeAllocator object. |
| MakeAllocator::Detach | Disassociates memory allocated by the Allocate method from the current MakeAllocator object. |
MakeAllocator
Header: implements.h
Namespace: Microsoft::WRL::Details
Supports the WRL infrastructure and is not intended to be used directly from your code.
__forceinline void* Allocate();If successful, a pointer to the allocated memory; otherwise, nullptr.
Allocates memory and associates it with the current MakeAllocator object.
The size of the allocated memory is the size of the type specified by the current MakeAllocator template parameter.
A developer needs to override only the Allocate() method to implement a different memory allocation model.
Supports the WRL infrastructure and is not intended to be used directly from your code.
__forceinline void Detach();Disassociates memory allocated by the Allocate method from the current MakeAllocator object.
If you call Detach(), you are responsible for deleting the memory provided by the Allocate method.
Supports the WRL infrastructure and is not intended to be used directly from your code.
MakeAllocator();Initializes a new instance of the MakeAllocator class.
Supports the WRL infrastructure and is not intended to be used directly from your code.
~MakeAllocator();Deinitializes the current instance of the MakeAllocator class.
This destructor also deletes the underlying allocated memory if necessary.