#include <sorted.h>
Static Public Member Functions | |
static constexpr auto | MakeAddPredicate (size_t inner_size) |
![]() | |
template<typename Iterator , typename Predicate > | |
static Iterator | FindPrevIf (Iterator before_first, Iterator last, Predicate predicate) |
static auto | MakeCanAllocPredicate (Layout layout) |
Additional Inherited Members | |
![]() | |
using | BlockType = BlockType_ |
using | ItemType = 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) |
BlockType * | RemoveAny () |
bool | Remove (BlockType &block) |
BlockType * | RemoveCompatible (Layout layout) |
void | Clear () |
Removes all blocks from this bucket. | |
template<typename Iterator > | |
constexpr BlockType * | GetBlockFromIterator (Iterator iter, Iterator last) |
template<typename Iterator > | |
constexpr BlockType * | GetBlockFromPrev (Iterator prev, Iterator last) |
![]() | |
static ItemType & | GetItemFrom (BlockType &block) |
Container of free blocks sorted in order of decreasing 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 largest free block.
|
inlinestaticconstexpr |
Returns a lambda that tests if the block storing an item has an inner size smaller than the given inner_size
.
This lambda can be used with std::find_if
and FindPrevIf
.