An ordered list of free memory blocks that coalesces contiguous blocks on insertion. More...
#include <coalescing_free_list.hpp>
Public Member Functions | |
coalescing_free_list (coalescing_free_list const &)=delete | |
coalescing_free_list & | operator= (coalescing_free_list const &)=delete |
coalescing_free_list (coalescing_free_list &&)=delete | |
coalescing_free_list & | operator= (coalescing_free_list &&)=delete |
void | insert (block_type const &block) |
Inserts a block into the free_list in the correct order, coalescing it with the preceding and following blocks if either is contiguous. More... | |
void | insert (free_list &&other) |
Moves blocks from free_list other into this free_list in their correct order, coalescing them with their preceding and following blocks if they are contiguous. More... | |
block_type | get_block (std::size_t size) |
Finds the smallest block in the free_list large enough to fit size bytes. More... | |
![]() | |
free_list (free_list const &)=delete | |
free_list (free_list &&)=delete | |
free_list & | operator= (free_list const &)=delete |
free_list & | operator= (free_list &&)=delete |
iterator | begin () noexcept |
beginning of the free list | |
const_iterator | begin () const noexcept |
beginning of the free list | |
const_iterator | cbegin () const noexcept |
beginning of the free list | |
iterator | end () noexcept |
end of the free list | |
const_iterator | end () const noexcept |
beginning of the free list | |
const_iterator | cend () const noexcept |
beginning of the free list | |
size_type | size () const noexcept |
The size of the free list in blocks. More... | |
bool | is_empty () const noexcept |
checks whether the free_list is empty. More... | |
void | erase (const_iterator iter) |
Removes the block indicated by iter from the free list. More... | |
void | clear () noexcept |
Erase all blocks from the free_list. | |
Additional Inherited Members | |
![]() | |
using | block_type = block |
using | list_type = std::list< block > |
using | size_type = typename list_type::size_type |
using | iterator = typename list_type::iterator |
using | const_iterator = typename list_type::const_iterator |
![]() | |
void | insert (const_iterator pos, block_type const &block) |
Insert a block in the free list before the specified position. More... | |
void | splice (const_iterator pos, free_list &&other) |
Inserts a list of blocks in the free list before the specified position. More... | |
void | push_back (const block_type &block) |
Appends the given block to the end of the free list. More... | |
void | push_back (block_type &&block) |
Appends the given block to the end of the free list. b is moved to the new element. More... | |
void | pop_front () |
Removes the first element of the free list. If there are no elements in the free list, the behavior is undefined. More... | |
An ordered list of free memory blocks that coalesces contiguous blocks on insertion.
list_type | the type of the internal list data structure. |
|
inline |
Finds the smallest block in the free_list
large enough to fit size
bytes.
This is a "best fit" search.
size | The size in bytes of the desired block. |
size
bytes.
|
inline |
Inserts a block into the free_list
in the correct order, coalescing it with the preceding and following blocks if either is contiguous.
b | The block to insert. |
|
inline |