C/C++ API Reference
Loading...
Searching...
No Matches
pw::allocator::ForwardSortedBucket< BlockType > Class Template Reference

Overview

template<typename BlockType>
class pw::allocator::ForwardSortedBucket< BlockType >

Container of free blocks sorted in order of increasing size.

As noted in the base class, this class relies on a forward list. This allows the free blocks to be as small as a single pointer, but makes insertion and lookup O(n) on the number of blocks in the bucket.

Calling RemoveAny() on this bucket will return the smallest free block.

Inheritance diagram for pw::allocator::ForwardSortedBucket< BlockType >:
pw::allocator::internal::SortedBucketBase< ForwardSortedBucket< BlockType >, BlockType > pw::allocator::internal::BucketBase< Derived, BlockType_, ItemType_ >

Additional Inherited Members

- Public Types inherited from pw::allocator::internal::BucketBase< Derived, BlockType_, ItemType_ >
using BlockType = BlockType_
 
using ItemType = ItemType_
 
- Public Member Functions inherited from pw::allocator::internal::BucketBase< Derived, BlockType_, ItemType_ >
constexpr bool empty () const
 Returns whether this buckets contains any free blocks.
 
constexpr size_t max_inner_size () const
 Returns the configured maximum inner size for blocks in this bucket.
 
constexpr void set_max_inner_size (size_t max_inner_size)
 
bool Add (BlockType &block)
 
const BlockType * FindLargest () const
 
BlockType * RemoveAny ()
 
bool Remove (BlockType &block)
 
BlockType * RemoveCompatible (Layout layout)
 
void Clear ()
 Removes all blocks from this bucket.
 
- Protected Types inherited from pw::allocator::internal::SortedBucketBase< ForwardSortedBucket< BlockType >, BlockType >
using Base = BucketBase< ForwardSortedBucket< BlockType >, BlockType, SortedItem >
 
- Protected Member Functions inherited from pw::allocator::internal::SortedBucketBase< ForwardSortedBucket< BlockType >, BlockType >
const IntrusiveForwardList< SortedItem > & items () const
 
void DoAdd (BlockType &block)
 
BlockType * DoRemoveAny ()
 
bool DoRemove (BlockType &block)
 
BlockType * DoRemoveCompatible (Layout layout)
 
- Static Protected Member Functions inherited from pw::allocator::internal::BucketBase< Derived, BlockType_, ItemType_ >
template<typename Iterator , typename Predicate >
static Iterator FindPrevIf (Iterator before_first, Iterator last, Predicate predicate)
 
static auto MakeCanAllocPredicate (Layout layout)
 
static bool Compare (const ItemType &item1, const ItemType &item2)
 
template<typename Iterator >
static constexpr BlockType * GetBlockFromIterator (Iterator iter, Iterator last)
 
template<typename Iterator >
static constexpr BlockType * GetBlockFromPrev (Iterator prev, Iterator last)
 
static ItemType & GetItemFrom (BlockType &block)
 
- Protected Attributes inherited from pw::allocator::internal::SortedBucketBase< ForwardSortedBucket< BlockType >, BlockType >
friend Base
 

The documentation for this class was generated from the following file: