Base class defining an interface for a list of free memory blocks.
More...
#include <free_list.hpp>
|
using | block_type = BlockType |
|
using | list_type = ListType |
|
using | size_type = typename list_type::size_type |
|
using | iterator = typename list_type::iterator |
|
using | const_iterator = typename list_type::const_iterator |
|
|
| free_list (free_list const &)=delete |
|
free_list & | operator= (free_list const &)=delete |
|
| free_list (free_list &&)=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.
|
|
|
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...
|
|
template<typename BlockType, typename ListType = std::list<BlockType>>
class rmm::mr::detail::free_list< BlockType, ListType >
Base class defining an interface for a list of free memory blocks.
Derived classes typically provide additional methods such as the following (see fixed_size_free_list.hpp and coalescing_free_list.hpp). However this is not a required interface.
void insert(block_type const& b) // insert a block into the free list
void insert(free_list&& other) // insert / merge another free list
block_type get_block(std::size_t size) // get a block of at least size bytes -
void print() // print the block`
- Template Parameters
-
list_type | the type of the internal list data structure. |
◆ erase()
template<typename BlockType , typename ListType = std::list<BlockType>>
Removes the block indicated by iter
from the free list.
- Parameters
-
iter | An iterator referring to the block to erase. |
◆ insert()
template<typename BlockType , typename ListType = std::list<BlockType>>
Insert a block in the free list before the specified position.
- Parameters
-
pos | iterator before which the block will be inserted. pos may be the end() iterator. |
block | The block to insert. |
◆ is_empty()
template<typename BlockType , typename ListType = std::list<BlockType>>
checks whether the free_list is empty.
- Returns
- true If there are blocks in the free_list.
-
false If there are no blocks in the free_list.
◆ pop_front()
template<typename BlockType , typename ListType = std::list<BlockType>>
Removes the first element of the free list. If there are no elements in the free list, the behavior is undefined.
References and iterators to the erased element are invalidated.
◆ push_back() [1/2]
template<typename BlockType , typename ListType = std::list<BlockType>>
Appends the given block to the end of the free list. b
is moved to the new element.
- Parameters
-
block | The block to append. |
◆ push_back() [2/2]
template<typename BlockType , typename ListType = std::list<BlockType>>
Appends the given block to the end of the free list.
- Parameters
-
block | The block to append. |
◆ size()
template<typename BlockType , typename ListType = std::list<BlockType>>
The size of the free list in blocks.
- Returns
- size_type The number of blocks in the free list.
◆ splice()
template<typename BlockType , typename ListType = std::list<BlockType>>
Inserts a list of blocks in the free list before the specified position.
- Parameters
-
pos | iterator before which the block will be inserted. pos may be the end() iterator. |
other | The free list to insert. |
The documentation for this class was generated from the following file: