44# ifndef TPL_DYNLISTSTACK_H
45# define TPL_DYNLISTSTACK_H
294 template <
typename...
Args>
297 return push(
T(std::forward<Args>(
args)...));
316 T &
put(
T && data) {
return push(std::forward<T>(data)); }
426 template <
class Operation>
433 template <
class Operation>
440 template <
class Operation>
447 template <
class Operation>
468 return this->
find_ptr([&key](
const T & item) {
return item == key; });
486 return search(key) !=
nullptr;
Variadic constructor macros for containers.
DRY (Don't Repeat Yourself) utilities and macros.
#define Special_Ctors(Set_Type, Type)
Generates special constructors for containers.
Iterator traits and STL-compatible iterator wrappers.
Dynamic stack of elements of generic type T based on a singly linked list.
T & append(const T &data)
Alias for push() - required by Special_Ctors macro.
DynListStack(const DynListStack &other)
Copy constructor.
void clear() noexcept
Empties the container.
T Key_Type
Alias for Item_Type, required by EqualToMethod mixin.
T & top()
Return a modifiable reference to the top item of the stack.
bool traverse(Operation &&operation=Operation())
bool is_empty() const noexcept
Check if the stack is empty.
bool traverse(Operation &operation) const
DynListStack() noexcept
Construct an empty stack.
constexpr size_t size() const noexcept
Return the number of elements in the stack.
T & emplace(Args &&... args)
Construct an item in place at the top of the stack.
T & peek()
Alias for top() - returns reference to top item.
void swap(DynListStack &other) noexcept
Swap the contents of this stack with another.
T * search(const T &key) noexcept
Search for an item in the stack using equality comparison.
T get()
Alias for pop() - removes and returns the top item.
const T * search(const T &key) const noexcept
DynListStack & operator=(const DynListStack &rhs)
Copy assignment operator.
bool traverse(Operation &operation)
Traverse all elements from top to bottom.
const T & peek() const
Alias for top() const - returns const reference to top item.
bool contains(const T &key) const noexcept
Check if the stack contains a specific value.
T & push(T &&data)
Push an item by move onto the top of the stack.
T Item_Type
The type of elements stored in the stack.
DynListStack(DynListStack &&other) noexcept
Move constructor.
bool has(const T &key) const noexcept
Alias for contains().
T & put(const T &data)
Alias for push() - for compatibility with queue-like interfaces.
bool traverse(Operation &&operation=Operation()) const
T & insert(const T &data)
Alias for push() - for STL-like insert semantics.
T pop()
Remove and return the top item of the stack.
T & push(const T &data)
Push an item by copy onto the top of the stack.
const T & top() const
Return a const reference to the top item of the stack.
void empty() noexcept
Remove all elements from the stack.
Iterator on the items of list.
Dynamic singly linked list with functional programming support.
T & insert(const T &item)
T & get_first() const
Return the first item of the list.
void empty() noexcept
empty the list
DynList & swap(DynList &l) noexcept
Equality test for containers.
Common methods to the Aleph-w ( ) containers.
Common sequential searching methods on containers.
T * find_ptr(Operation &operation) noexcept(operation_is_noexcept< Operation >())
Find a pointer to an item in the container according to a searching criterion.
Mixin that adds STL begin()/end() and cbegin()/cend() to Aleph containers.
Singly linked list implementations with head-tail access.
Main namespace for Aleph-w library functions.
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
Iterator for traversing elements of the stack.
Iterator(const DynListStack< T > &stack) noexcept
Construct an iterator for a stack.
typename DynList< T >::Iterator Base
Base iterator type.
Generic list of items stored in a container.
bool traverse(Operation &operation) noexcept(traverse_is_noexcept< Operation >())
Traverse the container via its iterator and performs a conditioned operation on each item.