|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Node belonging to a double circular linked list with header node. More...
#include <tpl_dnode.H>
Classes | |
| class | Iterator |
Iterator on a list of Dnode objects. More... | |
Public Types | |
| using | key_type = T |
| The data type. | |
Public Member Functions | |
| Dnode< T > *& | get_next () const noexcept |
Return the next node to this | |
| Dnode< T > *& | get_prev () const noexcept |
Return the previous node to this | |
| Dnode< T > * | remove_prev () noexcept |
Remove the previous node to this; return its address. | |
| Dnode< T > * | remove_next () noexcept |
Remove the next node to this; return its address. | |
| Dnode< T > *& | get_first_ne () const noexcept |
| Get the first node. | |
| Dnode< T > *& | get_last_ne () const noexcept |
| Get the last node. | |
| Dnode< T > *& | get_first () const |
| Get the first node. | |
| Dnode< T > *& | get_last () const |
| Get the last node. | |
| Dnode< T > * | remove_last_ne () noexcept |
| Remove the last node and return its address. | |
| Dnode< T > * | remove_first_ne () noexcept |
| Remove the first node and return its address. | |
| Dnode< T > * | remove_last () |
| Remove the last node and return its address. | |
| Dnode< T > * | remove_first () |
| Remove the first node and return its address. | |
| Dnode () noexcept(std::is_nothrow_default_constructible_v< T >) | |
Construct a node, or the header of an empty list, whose item is T(): zero for an arithmetic type or a pointer. | |
| Dnode (const T &item) | |
Construct a node with a copy of item | |
| Dnode (T &&item) | |
| Construct a new node with the item moved. | |
| Dnode & | swap (Dnode &p) |
Swap this with p | |
| Dnode (const Dnode &node) | |
| Copy constructor. | |
| Dnode (Dnode &&node) noexcept | |
Move constructor: takes the place of node in its list and moves its item, which cannot throw. | |
| Dnode (Dnode &&node) | |
Move constructor for an item whose move may throw: moves the item of node and then takes its place in its list. | |
| Dnode & | operator= (const Dnode &p) |
| Copy assigment. | |
| Dnode & | operator= (Dnode &&p) |
| Move asignment. | |
| T & | get_data () noexcept |
| Return a modifiable reference to the data contained in the node. | |
| const T & | get_data () const noexcept |
| Return a modifiable reference to the data contained in the node. | |
| T & | get_key () noexcept |
See get_data(). | |
| const T & | get_key () const noexcept |
See get_data(). | |
Public Member Functions inherited from Aleph::Dlink | |
| template<typename T > | |
| Dnode< T > * | to_dnode () noexcept |
Convert this, which must be the link of a Dnode<T>, to that node. | |
| template<typename T > | |
| const Dnode< T > * | to_dnode () const noexcept |
Convert this, which must be the link of a Dnode<T>, to that constant node. | |
| template<typename T > | |
| T & | to_data () noexcept |
Return the item of the Dnode<T> whose link is this. | |
| template<typename T > | |
| const T & | to_data () const noexcept |
Return the constant item of the Dnode<T> whose link is this. | |
| Dlink () noexcept | |
| Initialize a node or an empty list. | |
| Dlink (const Dlink &l) noexcept | |
| Copy constructor. | |
| void | swap (Dlink *link) noexcept |
Swap this with list whose header is link. | |
| void | swap (Dlink &l) noexcept |
Swap this with list whose header is l. | |
| Dlink (Dlink &&l) noexcept | |
| Construct a new list with the items of l moved. | |
| Dlink & | operator= (const Dlink &l) noexcept |
| Copy assignation. | |
| Dlink & | operator= (Dlink &&l) noexcept |
| Move assignation. | |
| void | reset () noexcept |
Reset this | |
| void | init () noexcept |
See reset(). | |
| constexpr bool | is_empty () const noexcept |
Return true if this (as header node) is empty. | |
| constexpr bool | is_unitarian () const noexcept |
Return true if this (as header node) has exactly one element. | |
| constexpr bool | is_unitarian_or_empty () const noexcept |
Return true if this (as header node) has zero or one element. | |
| void | insert (Dlink *node) noexcept |
Insert node after this. | |
| void | push (Dlink *node) noexcept |
See insert(Dlink * node). | |
| void | append (Dlink *node) noexcept |
Insert node before this. | |
| Dlink *& | get_next () const noexcept |
Return the link that is after this | |
| Dlink *& | get_prev () const noexcept |
Return the link that is before this | |
| constexpr Dlink *& | get_first_ne () const noexcept |
If this is a header node, it return the first node of this | |
| constexpr Dlink *& | get_last_ne () const noexcept |
If this is a header node, it return the last node of this | |
| constexpr Dlink *& | get_first () const noexcept |
If this is a header node, it return the first node of this | |
| constexpr Dlink *& | get_last () const noexcept |
If this is a header node, it return the last node of this | |
| void | wrap_header (Dlink *l) noexcept |
| Wrap a header to a list (without header). | |
| void | insert_list (Dlink *head) noexcept |
Insert the list head after this | |
| void | append_list (Dlink *head) noexcept |
Insert the list head before this | |
| void | splice (Dlink *l) noexcept |
Insert a list l without header node after the node this. | |
| void | concat_list (Dlink *head) noexcept |
Concatenate list head to list this | |
| void | concat_list (Dlink &head) noexcept |
See concat_list(Dlink * head). | |
| Dlink * | del () noexcept |
Remove this from the list. this must not be a header node. | |
| void | erase () noexcept |
See del(). | |
| Dlink * | remove_prev () noexcept |
Remove the item that is before this | |
| Dlink * | remove_next () noexcept |
Remove the item that is after this | |
| Dlink * | remove_last_ne () noexcept |
See remove_prev(). | |
| Dlink * | remove_first_ne () noexcept |
See remove_next(). | |
| Dlink * | remove_last () noexcept |
See remove_prev(). | |
| Dlink * | remove_first () noexcept |
See remove_next(). | |
| Dlink * | top () const |
See get_next(). | |
| Dlink * | pop () |
See remove_next(). | |
| size_t | reverse_list () noexcept |
| Reverse the list. | |
| size_t | reverse () noexcept |
See reverse_list. | |
| size_t | split_list_ne (Dlink &l, Dlink &r) noexcept |
Split this in the middle in two lists. | |
| size_t | split_list (Dlink &l, Dlink &r) noexcept |
| Dlink | cut_list (Dlink *link) noexcept |
Cut this from link. | |
| void | remove_all_and_delete () noexcept |
| Remove and free memory for all the items of list. | |
| void | rotate_left (size_t n) |
| Rotate to left the list n positions. | |
| void | rotate_right (size_t n) |
| Analogous to rotate_left() but to right. | |
| bool | check () |
Return true if the list is consistent. | |
Static Public Member Functions | |
| static Dnode * | data_to_node (T &data) noexcept |
Given an reference to the data in the node, returns a pointer to the Dnode object that contains it. | |
Private Attributes | |
| T | data |
Additional Inherited Members | |
Protected Attributes inherited from Aleph::Dlink | |
| Dlink * | prev |
| Dlink * | next |
Node belonging to a double circular linked list with header node.
Definition at line 105 of file tpl_dnode.H.
| using Aleph::Dnode< T >::key_type = T |
The data type.
Definition at line 272 of file tpl_dnode.H.
|
inlinenoexcept |
Construct a node, or the header of an empty list, whose item is T(): zero for an arithmetic type or a pointer.
An item built by default would be indeterminate for those types, and reading it, even to copy it, is undefined behavior.
| what | T() throws; nothing when it is noexcept, as for the arithmetic types and std::string. |
noexcept follows T() so that its exception reaches the caller instead of ending the program. Definition at line 182 of file tpl_dnode.H.
|
inline |
Construct a node with a copy of item
Definition at line 190 of file tpl_dnode.H.
|
inline |
Construct a new node with the item moved.
Definition at line 197 of file tpl_dnode.H.
Copy constructor.
Definition at line 213 of file tpl_dnode.H.
Move constructor: takes the place of node in its list and moves its item, which cannot throw.
| [in] | node | the node to move from. |
Definition at line 225 of file tpl_dnode.H.
Move constructor for an item whose move may throw: moves the item of node and then takes its place in its list.
| [in] | node | the node to move from. |
| what | the move constructor of T throws (its copy constructor, if T has no move one). Then node stays in its list and nothing is linked to this. |
noexcept, so that the exception reaches the caller instead of ending the program; the links are taken after the item, so that an exception leaves no list pointing to a node that was never built. Definition at line 243 of file tpl_dnode.H.
References Aleph::Dlink::swap().
|
inlinestaticnoexcept |
Given an reference to the data in the node, returns a pointer to the Dnode object that contains it.
Definition at line 282 of file tpl_dnode.H.
References Aleph::Dnode< T >::data, and offset.
Referenced by Aleph::DynHashTable< Key, HashTable, Cmp >::key_to_bucket(), and Aleph::DynDlist< T >::remove().
|
inlinenoexcept |
Return a modifiable reference to the data contained in the node.
Definition at line 269 of file tpl_dnode.H.
References Aleph::Dnode< T >::data.
|
inlinenoexcept |
Return a modifiable reference to the data contained in the node.
Definition at line 266 of file tpl_dnode.H.
References Aleph::Dnode< T >::data.
Referenced by Aleph::DynDlist< T >::Iterator::del(), main(), main(), printList(), Aleph::sort_utils_detail::radix_sort_impl(), Aleph::random_search(), Aleph::search_extreme(), Aleph::search_extreme(), Aleph::sequential_search(), Aleph::sequential_search(), and Aleph::Dlink::to_data().
|
inline |
Get the first node.
Definition at line 132 of file tpl_dnode.H.
References ah_underflow_error_if, Aleph::Dnode< T >::get_first_ne(), and Aleph::Dlink::is_empty().
|
inlinenoexcept |
Get the first node.
Definition at line 126 of file tpl_dnode.H.
References Aleph::Dnode< T >::get_next().
Referenced by Aleph::Dnode< T >::get_first().
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Get the last node.
Definition at line 139 of file tpl_dnode.H.
References ah_underflow_error_if, Aleph::Dnode< T >::get_last_ne(), and Aleph::Dlink::is_empty().
|
inlinenoexcept |
Get the last node.
Definition at line 129 of file tpl_dnode.H.
References Aleph::Dnode< T >::get_prev().
Referenced by Aleph::Dnode< T >::get_last().
|
inlinenoexcept |
Return the next node to this
Definition at line 114 of file tpl_dnode.H.
References Aleph::Dlink::next.
Referenced by Aleph::Dnode< T >::get_first_ne(), Aleph::DynDlist< T >::get_first_ne(), and Aleph::DynDlist< T >::get_first_ne().
|
inlinenoexcept |
Return the previous node to this
Definition at line 117 of file tpl_dnode.H.
References Aleph::Dlink::prev.
Referenced by Aleph::Dnode< T >::get_last_ne(), Aleph::DynDlist< T >::get_last_ne(), and Aleph::DynDlist< T >::get_last_ne().
|
inline |
Remove the first node and return its address.
Definition at line 165 of file tpl_dnode.H.
References ah_underflow_error_if, Aleph::Dlink::is_empty(), and Aleph::Dnode< T >::remove_first_ne().
|
inlinenoexcept |
Remove the first node and return its address.
Definition at line 152 of file tpl_dnode.H.
References Aleph::Dlink::remove_next().
Referenced by Aleph::sort_utils_detail::radix_sort_impl(), and Aleph::Dnode< T >::remove_first().
|
inline |
Remove the last node and return its address.
Definition at line 158 of file tpl_dnode.H.
References ah_underflow_error_if, Aleph::Dlink::is_empty(), and Aleph::Dnode< T >::remove_last_ne().
|
inlinenoexcept |
Remove the last node and return its address.
Definition at line 146 of file tpl_dnode.H.
References Aleph::Dlink::remove_prev().
Referenced by Aleph::Dnode< T >::remove_last().
|
inlinenoexcept |
Remove the next node to this; return its address.
Definition at line 123 of file tpl_dnode.H.
References Aleph::Dlink::remove_next().
Referenced by Aleph::DynDlist< T >::delete_end(), and Aleph::DynDlist< T >::empty().
|
inlinenoexcept |
Remove the previous node to this; return its address.
Definition at line 120 of file tpl_dnode.H.
References Aleph::Dlink::remove_prev().
Referenced by Aleph::DynDlist< T >::delete_end().
Swap this with p
Definition at line 204 of file tpl_dnode.H.
References Aleph::Dnode< T >::data, and Aleph::Dlink::swap().
|
private |
Definition at line 109 of file tpl_dnode.H.
Referenced by Aleph::Dnode< T >::data_to_node(), Aleph::DynDlist< T >::erase(), Aleph::Dnode< T >::get_data(), Aleph::Dnode< T >::get_data(), Aleph::Dnode< T >::get_key(), Aleph::Dnode< T >::get_key(), Aleph::Dnode< T >::operator=(), Aleph::Dnode< T >::operator=(), Aleph::DynDlist< T >::remove(), and Aleph::Dnode< T >::swap().