template<typename T>
class pw::allocator::TypedPool< T >
Typed pool that can be used for slab allocation.
This class is a special purpose pool designed to allocate objects of one specific type, T. It is useful when you need a dynamic pool of objects with very low performance and memory overhead costs. For example, a dispatcher might use such an allocator to manage memory for a set of task objects.
- Template Parameters
-
| T | The type of object to allocate memory for. |
|
| template<size_t kNumObjects> |
| | TypedPool (Buffer< kNumObjects > &buffer) |
| |
| | TypedPool (ByteSpan region) |
| |
| template<int &... kExplicitGuard, typename... Args> |
| T * | New (Args &&... args) |
| |
| template<int &... kExplicitGuard, typename... Args> |
| UniquePtr< T > | MakeUnique (Args &&... args) |
| |
| | ChunkPool (ByteSpan region, const Layout &layout) |
| |
|
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 |
| |
|
constexpr bool | HasCapability (Capability capability) const |
| | Returns whether a given capability is enabled for this object.
|
| |
| void | Deallocate (void *ptr) |
| |
| 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) |
| |