mCRL2
|
This essentially implements the std::forward_list, with the difference that it does not own the nodes in the list. It just keeps track of the list next pointers. Furthermore this assumes that the objects in the list will not be accessed, so it stores the next pointer within the Element. More...
#include <free_list.h>
Classes | |
union | slot |
The nodes of the free list without. More... | |
class | slot_iterator |
Iterator over all keys in a bucket list. More... | |
Public Types | |
using | Freelist = free_list< Element > |
using | iterator = slot_iterator< false > |
using | const_iterator = slot_iterator< true > |
Public Member Functions | |
free_list () | |
iterator | begin () |
iterator | end () |
iterator | before_begin () |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | before_begin () const |
iterator | erase_after (iterator it) |
Removes the element after the given iterator from the list. The returned iterator. | |
void | clear () |
Empties the bucket list. | |
bool | contains (Element *pointer) |
std::size_t | count () |
void | destructive_mark () |
Mark all elements in this list with a special value, destroys the list. | |
bool | empty () const noexcept |
iterator | insert_after (iterator it, slot &element) |
Inserts an element at the position after the iterator. | |
Element & | pop_front () |
Removes the head of the list and returns a reference to this head slot. | |
void | push_front (slot &slot) |
Puts the given node before the head of the list. | |
void | erase_after (iterator position, iterator last) |
Erases elements in the range (position, last], constant complexity since no destructors will be called. | |
Static Public Attributes | |
static constexpr std::uintptr_t | FreeListSentinel = std::numeric_limits<std::uintptr_t>::max() |
A sentinel value for the next of a slot to indicate that it belonged to the freelist. | |
Private Member Functions | |
slot & | head () noexcept |
Provides access to the head as if it was an actual slot. | |
const slot & | head () const noexcept |
Private Attributes | |
slot | m_head |
The first node in the bucket list. | |
This essentially implements the std::forward_list, with the difference that it does not own the nodes in the list. It just keeps track of the list next pointers. Furthermore this assumes that the objects in the list will not be accessed, so it stores the next pointer within the Element.
Definition at line 31 of file free_list.h.
using mcrl2::utilities::detail::free_list< Element >::const_iterator = slot_iterator<true> |
Definition at line 143 of file free_list.h.
using mcrl2::utilities::detail::free_list< Element >::Freelist = free_list<Element> |
Definition at line 141 of file free_list.h.
using mcrl2::utilities::detail::free_list< Element >::iterator = slot_iterator<false> |
Definition at line 142 of file free_list.h.
|
inline |
Definition at line 145 of file free_list.h.
|
inline |
Definition at line 152 of file free_list.h.
|
inline |
Definition at line 159 of file free_list.h.
|
inline |
Definition at line 148 of file free_list.h.
|
inline |
Definition at line 155 of file free_list.h.
|
inline |
Empties the bucket list.
Definition at line 177 of file free_list.h.
|
inline |
Definition at line 180 of file free_list.h.
|
inline |
Definition at line 195 of file free_list.h.
|
inline |
Mark all elements in this list with a special value, destroys the list.
Definition at line 206 of file free_list.h.
|
inlinenoexcept |
Definition at line 219 of file free_list.h.
|
inline |
Definition at line 149 of file free_list.h.
|
inline |
Definition at line 156 of file free_list.h.
|
inline |
Removes the element after the given iterator from the list. The returned iterator.
Definition at line 162 of file free_list.h.
|
inline |
Erases elements in the range (position, last], constant complexity since no destructors will be called.
Definition at line 250 of file free_list.h.
|
inlineprivatenoexcept |
Definition at line 258 of file free_list.h.
|
inlineprivatenoexcept |
Provides access to the head as if it was an actual slot.
Definition at line 257 of file free_list.h.
|
inline |
Inserts an element at the position after the iterator.
Definition at line 225 of file free_list.h.
|
inline |
Removes the head of the list and returns a reference to this head slot.
Definition at line 234 of file free_list.h.
|
inline |
Puts the given node before the head of the list.
Definition at line 242 of file free_list.h.
|
staticconstexpr |
A sentinel value for the next of a slot to indicate that it belonged to the freelist.
Definition at line 36 of file free_list.h.
|
private |
The first node in the bucket list.
This wastes sizeof(Element) space, because slot can store both an Element or a next pointer.
Definition at line 262 of file free_list.h.