|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Dynamic stack of elements of generic type T based on a singly linked list. More...
#include <tpl_dynListStack.H>
Classes | |
| struct | Iterator |
| Iterator for traversing elements of the stack. More... | |
Public Types | |
| using | Set_Type = DynListStack |
| The container type (self-reference for generic programming). | |
| using | Item_Type = T |
| The type of elements stored in the stack. | |
| using | Key_Type = T |
| Alias for Item_Type, required by EqualToMethod mixin. | |
Public Types inherited from StlAlephIterator< DynListStack< T > > | |
| using | iterator = StlIterator< DynListStack< T > > |
| using | const_iterator = StlConstIterator< DynListStack< T > > |
Public Member Functions | |
| void | swap (DynListStack &other) noexcept |
| Swap the contents of this stack with another. | |
| DynListStack () noexcept | |
| Construct an empty stack. | |
| DynListStack (const DynListStack &other) | |
| Copy constructor. | |
| DynListStack (DynListStack &&other) noexcept | |
| Move constructor. | |
| template<template< typename > class List> | |
| DynListStack (const List< T > &l) | |
| Enable special constructors from ah-args-ctor.H (initializer_list, etc.) | |
| template<class It > | |
| DynListStack (It b, It e) | |
| DynListStack (std::initializer_list< T > l) | |
| DynListStack & | operator= (const DynListStack &rhs) |
| Copy assignment operator. | |
| DynListStack & | operator= (DynListStack &&rhs) noexcept |
| Move assignment operator. | |
| constexpr size_t | size () const noexcept |
| Return the number of elements in the stack. | |
| bool | is_empty () const noexcept |
| Check if the stack is empty. | |
| T & | push (const T &data) |
| Push an item by copy onto the top of the stack. | |
| T & | push (T &&data) |
| Push an item by move onto the top of the stack. | |
| template<typename... Args> | |
| T & | emplace (Args &&... args) |
| Construct an item in place at the top of the stack. | |
| T & | append (const T &data) |
| Alias for push() - required by Special_Ctors macro. | |
| T & | append (T &&data) |
| T & | put (const T &data) |
| Alias for push() - for compatibility with queue-like interfaces. | |
| T & | put (T &&data) |
| T & | insert (const T &data) |
| Alias for push() - for STL-like insert semantics. | |
| T & | insert (T &&data) |
| T | pop () |
| Remove and return the top item of the stack. | |
| T | get () |
| Alias for pop() - removes and returns the top item. | |
| T & | top () |
| Return a modifiable reference to the top item of the stack. | |
| const T & | top () const |
| Return a const reference to the top item of the stack. | |
| T & | peek () |
| Alias for top() - returns reference to top item. | |
| const T & | peek () const |
| Alias for top() const - returns const reference to top item. | |
| void | empty () noexcept |
| Remove all elements from the stack. | |
| void | clear () noexcept |
| Alias for empty() - removes all elements. | |
| template<class Operation > | |
| bool | traverse (Operation &operation) |
| Traverse all elements from top to bottom. | |
| template<class Operation > | |
| bool | traverse (Operation &operation) const |
| template<class Operation > | |
| bool | traverse (Operation &&operation=Operation()) const |
| template<class Operation > | |
| bool | traverse (Operation &&operation=Operation()) |
| T * | search (const T &key) noexcept |
| Search for an item in the stack using equality comparison. | |
| const T * | search (const T &key) const noexcept |
| bool | contains (const T &key) const noexcept |
| Check if the stack contains a specific value. | |
| bool | has (const T &key) const noexcept |
| Alias for contains(). | |
Public Member Functions inherited from LocateFunctions< DynListStack< T >, T > | |
| auto | get_it () const |
| Return a properly initialized iterator positioned at the first item on the container. | |
| auto | get_it (const size_t pos) const |
Return a properly initialized iterator positioned at the pos item on the container. | |
| auto | get_itor () const |
Alias of get_it(). | |
| T & | nth_ne (const size_t n) noexcept |
| Return the n‑th element without bounds checking. | |
| const T & | nth_ne (const size_t n) const noexcept |
Const overload of nth_ne(size_t). | |
| T & | nth (const size_t n) |
| Return the n-th item of container. | |
| const T & | nth (const size_t n) const |
Const overload of nth(size_t). | |
| T * | find_ptr (Operation &operation) noexcept(operation_is_noexcept< Operation >()) |
| Find a pointer to an item in the container according to a searching criteria. | |
| const T * | find_ptr (Operation &operation) const noexcept(operation_is_noexcept< Operation >()) |
Const overload of find_ptr(Operation&). | |
| const T * | find_ptr (Operation &&operation) const noexcept(operation_is_noexcept< Operation >()) |
Overload of find_ptr(Operation&) const that accepts rvalues. | |
| T * | find_ptr (Operation &&operation) noexcept(operation_is_noexcept< Operation >()) |
Overload of find_ptr(Operation&) that accepts rvalues. | |
| size_t | find_index (Operation &operation) const noexcept(operation_is_noexcept< Operation >()) |
| Find the position of an item in the container according to a searching criteria. | |
| size_t | find_index (Operation &&operation) const noexcept(operation_is_noexcept< Operation >()) |
Overload of find_index(Operation&) that accepts rvalues. | |
| std::tuple< bool, T > | find_item (Operation &operation) noexcept(operation_is_noexcept< Operation >()) |
| Safe sequential searching of an item matching a criteria. | |
| std::tuple< bool, T > | find_item (Operation &operation) const noexcept(operation_is_noexcept< Operation >()) |
| std::tuple< bool, T > | find_item (Operation &&operation) noexcept(operation_is_noexcept< Operation >()) |
| std::tuple< bool, T > | find_item (Operation &&operation) const noexcept(operation_is_noexcept< Operation >()) |
Public Member Functions inherited from FunctionalMethods< DynListStack< T >, T > | |
| void | emplace (Args &&... args) |
| Appends a new element into the container by constructing it in-place with the given args. | |
| void | emplace_end (Args &&... args) |
| void | emplace_ins (Args &&... args) |
| Insert a new element into the container by constructing it in-place with the given args. | |
| size_t | ninsert (Args ... args) |
| Insert n variadic items. | |
| size_t | nappend (Args ... args) |
| Append n variadic items. | |
| void | for_each (Operation &operation) |
| Traverse all the container and performs an operation on each element. | |
| void | for_each (Operation &operation) const |
Const overload of for_each(Operation&). | |
| void | for_each (Operation &&operation) const |
Overload of for_each(Operation&) const that accepts rvalues. | |
| void | for_each (Operation &&operation) |
Overload of for_each(Operation&) that accepts rvalues. | |
| void | each (Operation &operation) |
Alias of for_each(Operation&). | |
| void | each (Operation &operation) const |
Const alias of for_each(Operation&). | |
| void | each (Operation &&operation) const |
Const alias of for_each(Operation&) that accepts rvalues. | |
| void | each (Operation &&operation) |
Alias of for_each(Operation&) that accepts rvalues. | |
| void | each (size_t pos, const size_t slice, Operation &operation) const |
Traverse the container starting at pos taking one item every slice, performing a mutable operation on each visited element. | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
| void | mutable_for_each (Operation &operation) |
| void | mutable_for_each (Operation &&operation) |
| bool | all (Operation &operation) const |
| Check if all the elements of container satisfy a condition. | |
| bool | all (Operation &&operation) const |
Overload of all(Operation&) that accepts rvalues. | |
| bool | exists (Operation &op) const |
| Test for existence in the container of an element satisfying a criteria. | |
| bool | exists (Operation &&op) const |
Overload of exists(Operation&) that accepts rvalues. | |
| Aleph::DynList< __T > | maps (Operation &op) const |
| Map the elements of the container. | |
| Aleph::DynList< __T > | maps (Operation &&op) const |
Overload of maps(Operation&) that accepts rvalues. | |
| Aleph::DynList< __T > | maps_if (Prop prop, Operation &op) const |
| Conditional mapping of the elements of the container. | |
| Aleph::DynList< __T > | maps_if (Prop prop, Operation &&op) const |
Overload of maps_if(Prop, Operation&) that accepts rvalues. | |
| Aleph::DynList< T > | to_dynlist () const |
| Convert container to DynList. | |
| std::vector< T > | to_vector () const |
| Convert container to std::vector. | |
| __T | foldl (const __T &init, Op &op) const |
| Fold the elements of the container to a specific result. | |
| __T | foldl (const __T &init, Op &&op=Op()) const |
Overload of foldl(const __T&, Op&) that accepts rvalues. | |
| __T | fold_left (const __T &init, Op &op) const |
| Alias for foldl with the same accumulator type. | |
| __T | fold_left (const __T &init, Op &&op=Op()) const |
Overload of fold_left(const __T&, Op&) that accepts rvalues. | |
| T | fold (const T &init, Operation &operation) const |
| Simplified version of foldl() where the folded type is the same type of elements stored in the container. | |
| T | fold (const T &init, Operation &&operation) const |
Overload of fold(const T&, Operation&) that accepts rvalues. | |
| Aleph::DynList< T > | filter (Operation &operation) const |
| Filter the elements of a container according to a matching criteria. | |
| Aleph::DynList< T > | filter (Operation &&operation) const |
Overload of filter(Operation&) that accepts rvalues. | |
| Aleph::DynList< const T * > | ptr_filter (Operation &operation) const |
| Filter the elements of a container according to a matching criteria and return a pointer to the matched items in the container. | |
| Aleph::DynList< const T * > | ptr_filter (Operation &&operation) const |
Overload of ptr_filter(Operation&) that accepts rvalues. | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &operation) const |
| Filter the elements of a container according to a matching criteria and determine its positions respect to the traversal of container. | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &&operation) const |
Overload of pfilter(Operation&) that accepts rvalues. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &op) const |
| Exclusive partition of container according to a filter criteria. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &&op) const |
Overload of partition(Operation&) that accepts rvalues. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (size_t n) const |
| Exclusive partition of container in the nth item. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | split_half () const |
| Split the container into two halves by alternating elements. | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &op) const |
| Exclusive partition of container according to a filter criteria. | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &&op) const |
Overload of tpartition(Operation&) that accepts rvalues. | |
| size_t | length () const noexcept |
| Count the number of elements of a container. | |
| Aleph::DynList< T > | rev () const |
| Return a list with the elements of container in reverse order respect to its traversal order. | |
| Aleph::DynList< T > | take (const size_t n) const |
| Return a list with the first n elements seen in the container during its traversal. | |
| Aleph::DynList< T > | take (size_t i, const size_t j, const size_t step=1) const |
| Return a list with elements seen in the container between i and j position respect to its traversal. | |
| Aleph::DynList< T > | drop (const size_t n) const |
| Drop the first n elements seen in the container during its traversal. | |
| void | mutable_drop (const size_t n) |
| Drop the first n elements seen from container. | |
Public Member Functions inherited from GenericItems< Container, T > | |
| Aleph::DynList< T > | items () const |
| Return a list of all the elements of a container sorted by traversal order. | |
| Aleph::DynList< T > | keys () const |
Public Member Functions inherited from EqualToMethod< DynListStack< T > > | |
| bool | equal_to (const DynListStack< T > &r) const noexcept |
Test if elements of this are exactly contained in another container. | |
| bool | operator== (const DynListStack< T > &r) const noexcept |
| bool | operator!= (const DynListStack< T > &r) const noexcept |
| Negation of equal_to() | |
Public Member Functions inherited from StlAlephIterator< DynListStack< T > > | |
| iterator | begin () noexcept |
| Return an STL-compatible iterator to the first element. | |
| const_iterator | begin () const noexcept |
| Return a const iterator to the first element. | |
| iterator | end () noexcept |
| Return an STL-compatible end iterator. | |
| const_iterator | end () const noexcept |
| Return a const end iterator. | |
| const_iterator | cbegin () const noexcept |
| Return a const iterator to the first element. | |
| const_iterator | cend () const noexcept |
| Return a const end iterator. | |
Private Attributes | |
| DynList< T > | s |
| size_t | num_items = 0 |
Additional Inherited Members | |
Related Symbols inherited from FunctionalMethods< DynListStack< T >, T > | |
| each | |
| each | |
| each | |
Dynamic stack of elements of generic type T based on a singly linked list.
DynListStack<T> models a dynamic LIFO (Last-In-First-Out) stack with O(1) time complexity for push, pop, and top operations. The stack grows and shrinks dynamically as elements are added or removed.
This class is not thread-safe. External synchronization is required for concurrent access from multiple threads.
| T | Type of elements stored in the stack. Must be copy-constructible or move-constructible. |
Definition at line 103 of file tpl_dynListStack.H.
The type of elements stored in the stack.
Definition at line 119 of file tpl_dynListStack.H.
Alias for Item_Type, required by EqualToMethod mixin.
Definition at line 122 of file tpl_dynListStack.H.
| using Aleph::DynListStack< T >::Set_Type = DynListStack |
The container type (self-reference for generic programming).
Definition at line 116 of file tpl_dynListStack.H.
|
inlinenoexcept |
Construct an empty stack.
Creates a stack with no elements. The stack is ready to accept elements via push() or emplace().
Time complexity: O(1)
Definition at line 147 of file tpl_dynListStack.H.
|
inline |
Copy constructor.
Constructs a new stack as a copy of other. All elements are copied in LIFO order.
Time complexity: O(n) where n is the size of other.
| [in] | other | The stack to copy from. |
| std::bad_alloc | If memory allocation fails. |
| Any | exception thrown by T's copy constructor. |
Definition at line 160 of file tpl_dynListStack.H.
|
inlinenoexcept |
Move constructor.
Constructs a new stack by transferring ownership of resources from other. After this operation, other is left in a valid but unspecified state (typically empty).
Time complexity: O(1)
| [in,out] | other | The stack to move from. |
Definition at line 176 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), and Aleph::DynListStack< T >::swap().
|
inline |
Enable special constructors from ah-args-ctor.H (initializer_list, etc.)
Definition at line 182 of file tpl_dynListStack.H.
|
inline |
Definition at line 182 of file tpl_dynListStack.H.
|
inline |
Definition at line 182 of file tpl_dynListStack.H.
Alias for push() - required by Special_Ctors macro.
| [in] | data | The item to append. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 304 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
Referenced by TEST().
Definition at line 307 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
|
inlinenoexcept |
Alias for empty() - removes all elements.
Provided for compatibility with STL-style interfaces.
Definition at line 410 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::empty().
Check if the stack contains a specific value.
Time complexity: O(n)
| [in] | key | The value to search for. |
key is found in the stack, false otherwise. Definition at line 483 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::search().
Referenced by Aleph::DynListStack< T >::has(), and TEST().
|
inline |
Construct an item in place at the top of the stack.
Constructs an element directly at the top of the stack using the provided arguments. This avoids the overhead of creating a temporary object and then copying or moving it.
Time complexity: O(1)
| Args | Types of the constructor arguments. |
| [in] | args | Arguments to forward to the constructor of T. |
| std::bad_alloc | If memory allocation fails. |
| Any | exception thrown by T's constructor. |
Definition at line 295 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), and Aleph::DynListStack< T >::push().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
Remove all elements from the stack.
After this call, size() returns 0 and is_empty() returns true.
Time complexity: O(n) where n is the number of elements.
Definition at line 400 of file tpl_dynListStack.H.
References Aleph::DynList< T >::empty(), Aleph::DynListStack< T >::num_items, and Aleph::DynListStack< T >::s.
Referenced by Aleph::DynListStack< T >::clear(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::init_tarjan(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Alias for pop() - removes and returns the top item.
| std::underflow_error | If the stack is empty. |
Definition at line 350 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::pop().
Alias for contains().
Definition at line 489 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::contains().
Alias for push() - for STL-like insert semantics.
| [in] | data | The item to insert. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 322 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
Definition at line 325 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
|
inlinenoexcept |
Check if the stack is empty.
Time complexity: O(1)
Definition at line 239 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::num_items.
Referenced by Aleph::Tarjan_Connected_Components< GT, Itor, SA >::connected_components(), demo_comparison(), demo_stack(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::is_connected(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::test_connectivity(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inline |
Copy assignment operator.
Replaces the contents of this stack with a copy of rhs.
Time complexity: O(n + m) where n is the current size and m is the size of rhs.
| [in] | rhs | The stack to copy from. |
| std::bad_alloc | If memory allocation fails. |
| Any | exception thrown by T's copy constructor. |
Definition at line 196 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::num_items, and Aleph::DynListStack< T >::s.
|
inlinenoexcept |
Move assignment operator.
Replaces the contents of this stack by transferring ownership from rhs. After this operation, rhs is left in a valid but unspecified state.
Time complexity: O(1) (plus destruction of current elements).
| [in,out] | rhs | The stack to move from. |
Definition at line 218 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::num_items, Aleph::DynListStack< T >::s, and Aleph::DynList< T >::swap().
|
inline |
Alias for top() - returns reference to top item.
| std::underflow_error | If the stack is empty. |
Definition at line 386 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::top().
Alias for top() const - returns const reference to top item.
| std::underflow_error | If the stack is empty. |
Definition at line 392 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::top().
|
inline |
Remove and return the top item of the stack.
Removes the most recently pushed item from the stack and returns it.
Time complexity: O(1)
| std::underflow_error | If the stack is empty. |
Definition at line 339 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::num_items, Aleph::DynList< T >::remove_first(), and Aleph::DynListStack< T >::s.
Referenced by demo_comparison(), demo_stack(), Aleph::DynListStack< T >::get(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::pop_from_stack(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Push an item by copy onto the top of the stack.
Adds a copy of data to the top of the stack.
Time complexity: O(1)
| [in] | data | The item to be copied and pushed. |
| std::bad_alloc | If memory allocation fails. |
| Any | exception thrown by T's copy constructor. |
Definition at line 252 of file tpl_dynListStack.H.
References Aleph::DynList< T >::insert(), FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::num_items, and Aleph::DynListStack< T >::s.
Referenced by StringStack::StringStack(), Aleph::DynListStack< T >::append(), Aleph::DynListStack< T >::append(), demo_comparison(), demo_stack(), Aleph::DynListStack< T >::emplace(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::init_node_and_push_in_stack(), Aleph::DynListStack< T >::insert(), Aleph::DynListStack< T >::insert(), Aleph::DynListStack< T >::put(), Aleph::DynListStack< T >::put(), DynListStackTest::SetUp(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Push an item by move onto the top of the stack.
Moves data onto the top of the stack, avoiding a copy.
Time complexity: O(1)
| [in] | data | The item to be moved and pushed. |
| std::bad_alloc | If memory allocation fails. |
Definition at line 269 of file tpl_dynListStack.H.
References Aleph::DynList< T >::insert(), FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::num_items, and Aleph::DynListStack< T >::s.
Alias for push() - for compatibility with queue-like interfaces.
| [in] | data | The item to put. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 313 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
Definition at line 316 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
Definition at line 471 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::search().
Search for an item in the stack using equality comparison.
Performs a linear search from top to bottom looking for an element equal to key.
Time complexity: O(n)
| [in] | key | The value to search for. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 465 of file tpl_dynListStack.H.
References LocateFunctions< DynListStack< T >, T >::find_ptr().
Referenced by Aleph::DynListStack< T >::contains(), Aleph::DynListStack< T >::search(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlineconstexprnoexcept |
Return the number of elements in the stack.
Time complexity: O(1)
Definition at line 231 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::num_items.
Referenced by demo_stack(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
inlinenoexcept |
Swap the contents of this stack with another.
Exchanges the contents of this stack with those of other in constant time O(1). No elements are copied or moved individually.
| [in,out] | other | The stack to swap with. |
Definition at line 134 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::num_items, Aleph::DynListStack< T >::s, and Aleph::DynList< T >::swap().
Referenced by Aleph::DynListStack< T >::DynListStack(), TEST(), and TEST_F().
|
inline |
Return a modifiable reference to the top item of the stack.
Provides access to the top element without removing it.
Time complexity: O(1)
| std::underflow_error | If the stack is empty. |
Definition at line 363 of file tpl_dynListStack.H.
References Aleph::DynList< T >::get_first(), and Aleph::DynListStack< T >::s.
Referenced by demo_stack(), Aleph::DynListStack< T >::peek(), Aleph::DynListStack< T >::peek(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Return a const reference to the top item of the stack.
Provides read-only access to the top element without removing it.
Time complexity: O(1)
| std::underflow_error | If the stack is empty. |
Definition at line 377 of file tpl_dynListStack.H.
References Aleph::DynList< T >::get_first(), and Aleph::DynListStack< T >::s.
|
inline |
Definition at line 447 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::s, and GenericTraverse< Container >::traverse().
|
inline |
Definition at line 440 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::s, and GenericTraverse< Container >::traverse().
|
inline |
Traverse all elements from top to bottom.
Executes operation on each element in LIFO order (top to bottom). The traversal stops early if operation returns false.
| Operation | A callable type with signature bool(T&) or bool(const T&). |
| [in] | operation | The operation to perform on each element. |
operation returned true for all elements; false if traversal was stopped early.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 426 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::s, and GenericTraverse< Container >::traverse().
Referenced by TEST().
|
inline |
Definition at line 433 of file tpl_dynListStack.H.
References FunctionalMethods< DynListStack< T >, T >::maps(), Aleph::DynListStack< T >::s, and GenericTraverse< Container >::traverse().
|
private |
Definition at line 111 of file tpl_dynListStack.H.
Referenced by Aleph::DynListStack< T >::empty(), Aleph::DynListStack< T >::is_empty(), Aleph::DynListStack< T >::operator=(), Aleph::DynListStack< T >::operator=(), Aleph::DynListStack< T >::pop(), Aleph::DynListStack< T >::push(), Aleph::DynListStack< T >::push(), Aleph::DynListStack< T >::size(), and Aleph::DynListStack< T >::swap().
Definition at line 110 of file tpl_dynListStack.H.
Referenced by Aleph::DynListStack< T >::empty(), Aleph::DynListStack< T >::operator=(), Aleph::DynListStack< T >::operator=(), Aleph::DynListStack< T >::pop(), Aleph::DynListStack< T >::push(), Aleph::DynListStack< T >::push(), Aleph::DynListStack< T >::swap(), Aleph::DynListStack< T >::top(), Aleph::DynListStack< T >::top(), Aleph::DynListStack< T >::traverse(), Aleph::DynListStack< T >::traverse(), Aleph::DynListStack< T >::traverse(), and Aleph::DynListStack< T >::traverse().