39# ifndef TPL_DYNSLIST_H
40# define TPL_DYNSLIST_H
79 <<
"position out of range";
106 Node * head =
nullptr;
107 Node * tail =
nullptr;
116 auto * node =
new Node(
cur->get_data());
117 node->get_next() =
nullptr;
131 while (head !=
nullptr)
158 Node * head =
nullptr;
159 Node * tail =
nullptr;
168 auto * node =
new Node(
cur->get_data());
169 node->get_next() =
nullptr;
183 while (head !=
nullptr)
210 if (
other.is_empty())
226 other.current_pos = 0;
242 if (
other.is_empty())
258 other.current_pos = 0;
288 for (
size_t idx = 0; idx < i; ++idx)
291 return cur->get_data();
308 prev->insert_next(node);
319 prev->insert_next(node);
Exception handling system with formatted messages for Aleph-w.
#define ah_out_of_range_error_if(C)
Throws std::out_of_range if condition holds.
Iterator specialized for DynSlist returning payload references.
T & get_curr()
Return a reference to the current payload.
const T & get_curr() const
Return a const reference to the current payload.
Iterator(DynSlist &list)
Constructor.
T Item_Type
Type returned by get_curr().
Slist< T > Set_Type
Type of the data structure being iterated.
Dynamic list of elements of type T implemented with a singly linked list of nodes.
DynSlist & operator=(const DynSlist &other)
DynSlist(DynSlist &&other) noexcept
Slist< T >::Node * get_previous_to_pos(const size_t pos, const bool allow_equal)
T & operator[](const size_t i)
Access the element at position i.
const T & operator[](const size_t i) const
Const overload of operator[].
DynSlist(const DynSlist &other)
size_t size() const noexcept
Return the number of stored elements.
void remove(const int pos)
Remove the node at position pos.
void insert(const int pos, T &&data)
Insert an element by moving the provided value.
DynSlist & operator=(DynSlist &&other) noexcept
void insert(const int pos, const T &data)
Insert an element at position pos.
Snode< T > * current_node
void reset() noexcept
Reset the link so it points to itself.
constexpr bool is_empty() const noexcept
Return true if this link is empty (points to itself).
Node * get_curr()
Return the current node.
Singly linked list of nodes that store values of type T.
Node * remove_first_ne() noexcept
Remove and return the first node without checking emptiness.
Node * get_first_ne() noexcept
Return the first node without checking emptiness.
Singly linked node that stores data of type T.
T & get_data()
Return a modifiable reference to the stored data.
Snode *& get_next()
Return the next node after this.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
std::decay_t< typename HeadC::Item_Type > T
void next()
Advance all underlying iterators (bounds-checked).
Singly linked list with typed nodes.