Pigweed
|
#include <null_allocator.h>
Static Public Attributes | |
static constexpr Capabilities | kCapabilities = 0 |
Friends | |
NullAllocator & | GetNullAllocator () |
Returns a reference to the NullAllocator singleton. | |
Additional Inherited Members | |
![]() | |
using | Capabilities = allocator::Capabilities |
using | Capability = allocator::Capability |
using | Layout = allocator::Layout |
![]() | |
void * | Allocate (Layout layout) |
template<typename T , int &... ExplicitGuard, typename... Args> | |
T * | New (Args &&... args) |
template<typename T , int &... ExplicitGuard, typename... Args> | |
UniquePtr< T > | MakeUnique (Args &&... args) |
bool | Resize (void *ptr, size_t new_size) |
bool | Resize (void *ptr, Layout layout, size_t new_size) |
void * | Reallocate (void *ptr, Layout new_layout) |
void * | Reallocate (void *ptr, Layout old_layout, size_t new_size) |
allocator::AsPmrAllocator | as_pmr () |
![]() | |
const Capabilities & | capabilities () const |
bool | HasCapability (Capability capability) const |
Returns whether a given capabilityis enabled for this object. | |
void | Deallocate (void *ptr) |
void | Deallocate (void *ptr, Layout layout) |
template<typename T > | |
void | Delete (T *ptr) |
StatusWithSize | GetCapacity () const |
bool | IsEqual (const Deallocator &other) const |
![]() | |
constexpr | Allocator ()=default |
TODO(b/326509341): Remove when downstream consumers migrate. | |
constexpr | Allocator (const Capabilities &capabilities) |
![]() | |
constexpr | Deallocator ()=default |
TODO(b/326509341): Remove when downstream consumers migrate. | |
constexpr | Deallocator (const Capabilities &capabilities) |
template<typename T > | |
UniquePtr< T > | WrapUnique (T *ptr) |
A memory allocator that always fails to allocate memory.
A null allocator may be useful as part of a larger framework if allocation should be disallowed under certain circumstances. For example, a function that returns different allocators based on an input parameter may return a null allocator when given an invalid or unsupported parameter value.