Abstract interface for fixed-layout memory allocation.
The interface makes no guarantees about its implementation. Consumers of the generic interface must not make any assumptions around allocator behavior, thread safety, or performance.
|
constexpr | Pool (const Capabilities &capabilities, const Layout &layout) |
|
constexpr const Layout & | layout () const |
|
void * | Allocate () |
|
|
template<typename T , int &... kExplicitGuard, std::enable_if_t<!std::is_array_v< T >, int > = 0, typename... Args> |
T * | New (Args &&... args) |
|
template<typename T , int &... kExplicitGuard, typename ElementType = std::remove_extent_t<T>, std::enable_if_t< is_bounded_array_v< T >, int > = 0> |
ElementType * | New () |
|
template<typename T , int &... kExplicitGuard, typename ElementType = std::remove_extent_t<T>, std::enable_if_t< is_unbounded_array_v< T >, int > = 0> |
ElementType * | New () |
|
|
template<typename T , int &... kExplicitGuard, std::enable_if_t<!std::is_array_v< T >, int > = 0, typename... Args> |
UniquePtr< T > | MakeUnique (Args &&... args) |
|
template<typename T , int &... kExplicitGuard, std::enable_if_t< is_bounded_array_v< T >, int > = 0> |
UniquePtr< T > | MakeUnique () |
|
template<typename T , int &... kExplicitGuard, std::enable_if_t< is_unbounded_array_v< T >, int > = 0> |
UniquePtr< T > | MakeUnique () |
|
constexpr const Capabilities & | capabilities () const |
|
bool | HasCapability (Capability capability) const |
| Returns whether a given capability is enabled for this object.
|
|
void | Deallocate (void *ptr) |
|
void | Deallocate (void *ptr, Layout layout) |
|
template<typename ElementType > |
void | DeleteArray (ElementType *ptr, size_t count) |
|
StatusWithSize | GetCapacity () const |
|
bool | IsEqual (const Deallocator &other) const |
|
template<typename T , int &... kExplicitGuard, std::enable_if_t<!std::is_array_v< T >, int > = 0> |
void | Delete (T *ptr) |
|
template<typename T , int &... kExplicitGuard, typename ElementType = std::remove_extent_t<T>, std::enable_if_t< is_bounded_array_v< T >, int > = 0> |
void | Delete (ElementType *ptr) |
|
template<typename T , int &... kExplicitGuard, typename ElementType = std::remove_extent_t<T>, std::enable_if_t< is_unbounded_array_v< T >, int > = 0> |
void | Delete (ElementType *ptr, size_t count) |
|
template<typename T , int &... kExplicitGuard, std::enable_if_t<!std::is_array_v< T >, int > = 0, typename... Args>
UniquePtr< T > pw::allocator::Pool::MakeUnique |
( |
Args &&... |
args | ) |
|
|
inline |
Constructs an object and wraps it in a UniquePtr
This method is similar to Allocator::MakeUnique
, except that it is specific to the pool's layout.
- Template Parameters
-
T | Type of object to allocate. Either Layout::Of<T> must match the pool's layout, or T must be an unbounded array whose elements a size and alignment that evenly divide the pool's layout's size and alignment respectively. |
template<typename T , int &... kExplicitGuard, std::enable_if_t<!std::is_array_v< T >, int > = 0, typename... Args>
T * pw::allocator::Pool::New |
( |
Args &&... |
args | ) |
|
|
inline |
Allocates and constructs an object.
This method is similar to Allocator::New
, except that it is specific to the pool's layout.
- Template Parameters
-
T | Type of object to allocate. Either Layout::Of<T> must match the pool's layout, or T must be an unbounded array whose elements a size and alignment that evenly divide the pool's layout's size and alignment respectively. |