Implementation of Pool
that satisfies requests using an Allocator
.
More...
#include <allocator_as_pool.h>
|
using | Capabilities = allocator::Capabilities |
|
using | Capability = allocator::Capability |
|
using | Layout = allocator::Layout |
|
constexpr | Deallocator ()=default |
| TODO(b/326509341): Remove when downstream consumers migrate.
|
|
constexpr | Deallocator (const Capabilities &capabilities) |
|
template<typename T , std::enable_if_t<!std::is_array_v< T >, int > = 0> |
UniquePtr< T > | WrapUnique (T *ptr) |
|
template<typename T , int &... kExplicitGuard, typename ElementType = std::remove_extent_t<T>, std::enable_if_t< is_unbounded_array_v< T >, int > = 0> |
UniquePtr< T > | WrapUnique (ElementType *ptr, size_t size) |
|
template<typename T > |
UniquePtr< T[]> | WrapUniqueArray (T *ptr, size_t size) |
|
template<typename T > |
static constexpr bool | is_bounded_array_v |
|
template<typename T > |
static constexpr bool | is_unbounded_array_v |
|
Implementation of Pool
that satisfies requests using an Allocator
.
◆ AllocatorAsPool()
pw::allocator::AllocatorAsPool::AllocatorAsPool |
( |
Allocator & |
allocator, |
|
|
const Layout & |
layout |
|
) |
| |
Construct a Pool
from an Allocator
.
- Parameters
-
allocator | The allocator used to create fixed-size allocations. |
layout | The size and alignment of the memory to be returned from this pool. |
◆ DoAllocate()
void * pw::allocator::AllocatorAsPool::DoAllocate |
( |
| ) |
|
|
overrideprivatevirtual |
Returns a chunk of memory with this object's fixed layout.
Like pw::allocator::Allocate
, returns null if memory is exhausted.
- Return values
-
Implements pw::allocator::Pool.
◆ DoDeallocate()
void pw::allocator::AllocatorAsPool::DoDeallocate |
( |
void * |
ptr | ) |
|
|
overrideprivate |
Releases a previously-allocated block of memory.
The given pointer must have been previously provided by this memory resource; otherwise the behavior is undefined.
- Parameters
-
[in] | ptr | Pointer to previously-allocated memory. |
◆ DoGetInfo()
Result< Layout > pw::allocator::AllocatorAsPool::DoGetInfo |
( |
InfoType |
info_type, |
|
|
const void * |
ptr |
|
) |
| const |
|
overrideprivate |
The documentation for this class was generated from the following file: