|
Aleph-w 7.10.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. | |
| using | Const_Iterator = Aleph::Const_Iterator< Iterator > |
| Read-only iterator: the iterator of a constant container. | |
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 > requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != 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. | |
| 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) |
See append(const T & data). | |
| T & | put (const T &data) |
| Alias for push() - for compatibility with queue-like interfaces. | |
| T & | put (T &&data) |
See put(const T & data). | |
| T & | insert (const T &data) |
| Alias for push() - for STL-like insert semantics. | |
| T & | insert (T &&data) |
See insert(const 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 |
| Empties the container. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, T &> | |
| bool | traverse (Operation &operation) noexcept(noexcept(s.traverse(operation))) |
| Traverse all elements from top to bottom. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const T &> | |
| bool | traverse (Operation &operation) const noexcept(noexcept(s.traverse(operation))) |
See traverse(Operation & operation). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const T &> | |
| bool | traverse (Operation &&operation=Operation()) const noexcept(noexcept(s.traverse(operation))) |
See traverse(Operation & operation). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, T &> | |
| bool | traverse (Operation &&operation=Operation()) noexcept(noexcept(s.traverse(operation))) |
See traverse(Operation & operation). | |
| T * | search (const T &key) noexcept(noexcept(static_cast< bool >(std::declval< const T & >()==std::declval< const T & >()))) |
| Search for an item in the stack using equality comparison. | |
| const T * | search (const T &key) const noexcept(noexcept(static_cast< bool >(std::declval< const T & >()==std::declval< const T & >()))) |
See search(const T & key). | |
| bool | contains (const T &key) const noexcept(noexcept(static_cast< bool >(std::declval< const T & >()==std::declval< const T & >()))) |
| Check if the stack contains a specific value. | |
| bool | has (const T &key) const noexcept(noexcept(static_cast< bool >(std::declval< const T & >()==std::declval< const T & >()))) |
| Alias for contains(). | |
Public Member Functions inherited from LocateFunctions< DynListStack< T >, T > | |
| auto | get_it () |
| Return a properly initialized iterator positioned at the first item on the container. | |
| auto | get_it () const |
| Read-only iterator positioned at the first item. | |
| auto | get_it (const size_t pos) |
Return a properly initialized iterator positioned at the pos item on the container. | |
| auto | get_it (const size_t pos) const |
Read-only iterator positioned at the pos item. | |
| auto | get_itor () |
Alias of get_it(). | |
| auto | get_itor () const |
See get_itor(). | |
| T & | nth_ne (const size_t n) noexcept(Aleph::dry_detail::mutable_traversal_is_noexcept< C, T >) |
| Return the n‑th element without bounds checking. | |
| const T & | nth_ne (const size_t n) const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< DynListStack< T >, T >) |
Constant overload of nth_ne(size_t). | |
| T & | nth (const size_t n) |
| Return the n-th item of the container. | |
| const T & | nth (const size_t n) const |
Const overload of nth(size_t). | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynListStack< T >, Operation >::type, T > T * | find_ptr (Operation &operation) noexcept(mutable_search_is_noexcept< Operation >()) |
| Find a pointer to an item in the container according to a searching criterion. | |
| const T * | find_ptr (Operation &operation) const noexcept(const_search_is_noexcept< Operation >()) |
Const overload of find_ptr(Operation&). | |
| const T * | find_ptr (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Overload of find_ptr() const that accepts rvalues. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynListStack< T >, Operation >::type, T > T * | find_ptr (Operation &&operation) noexcept(mutable_search_is_noexcept< Operation >()) |
| Overload of find_ptr() that accepts rvalues. | |
| size_t | find_index (Operation &operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Find the position of an item in the container according to a searching criterion. | |
| size_t | find_index (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Overload of find_index() that accepts rvalues. | |
| and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, T > | find_item (Operation &operation) const noexcept(find_item_is_noexcept< Operation >()) |
| Safe sequential searching of an item matching a criterion. | |
| and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, T > | find_item (Operation &&operation) const noexcept(find_item_is_noexcept< Operation >()) |
| Overload of find_item() that accepts rvalues. | |
| and std::copy_constructible< T > std::optional< T > | find_opt (Operation &operation) const |
| Copy of the first item satisfying a criterion, if any. | |
| and std::copy_constructible< T > std::optional< T > | find_opt (Operation &&operation) const |
| Overload of find_opt() that accepts rvalues. | |
| bool | contains_if (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Test if an item satisfying a criterion is present in the container. | |
| bool | contains (const T &item) const |
| Test if an item is present in the container using equality. | |
Public Member Functions inherited from FunctionalMethods< DynListStack< T >, T > | |
| void | emplace (Args &&... args) |
| Appends a new element into the container by constructing it from the given args. | |
| void | emplace_end (Args &&... args) |
See emplace(Args && ... args). | |
| void | emplace_ins (Args &&... args) |
| size_t | ninsert (Args &&... args) |
| Insert n variadic items. | |
| size_t | nappend (Args &&... args) |
| Append n variadic items. | |
| void | for_each (Operation &operation) const |
| Traverse all the container and performs an operation on each element. | |
| void | for_each (Operation &&operation) const |
| Overload of for_each() that accepts rvalues. | |
| void | each (Operation &operation) const |
| Alias of for_each(). | |
| void | each (Operation &&operation) const |
| Alias of for_each() that accepts rvalues. | |
| void | each (const size_t pos, const size_t slice, Operation &operation) const |
Traverse the container starting at pos taking one item every slice, performing an operation on each visited element. | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
See each(size_t pos, size_t slice, Operation & operation) const. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynListStack< T >, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &operation) |
Traverse the container starting at pos taking one item every slice, performing an operation that may modify each visited item. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynListStack< T >, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &&operation) |
See each(size_t pos, size_t slice, Operation & operation). | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynListStack< T >, Operation >::type, T > void | mutable_for_each (Operation &operation) |
| Apply a mutable operation to each element of the container. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynListStack< T >, Operation >::type, T > void | mutable_for_each (Operation &&operation) |
See mutable_for_each(Operation & operation). | |
| bool | all (Operation &operation) const |
| Check if all the elements of the container satisfy a condition. | |
| bool | all (Operation &&operation) const |
| Overload of all() that accepts rvalues. | |
| bool | exists (Operation &op) const |
| Test for existence in the container of an element satisfying a criterion. | |
| bool | exists (Operation &&op) const |
| Overload of exists() that accepts rvalues. | |
| bool | none (Operation &op) const |
| Test that no element satisfies a criterion. | |
| bool | none (Operation &&op) const |
| Overload of none() that accepts rvalues. | |
| size_t | count_if (Operation &op) const |
| Count the elements that satisfy a criterion. | |
| size_t | count_if (Operation &&op) const |
| Overload of count_if() that accepts rvalues. | |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &&op) const |
| auto | flat_map (Operation &op) const |
| Map each element to a container and concatenate the results. | |
| auto | flat_map (Operation &&op) const |
| Overload of flat_map() that accepts rvalues. | |
| Aleph::DynList< T > | to_dynlist () const |
| Convert container to DynList. | |
| std::vector< T > | to_vector () const |
| Convert container to std::vector. | |
| Acc | foldl (const Acc &init, Op &op) const |
| Fold the elements of the container to a specific result. | |
| Acc | foldl (const Acc &init, Op &&op) const |
| Overload of foldl() that accepts rvalues. | |
| Acc | fold_left (const Acc &init, Op &op) const |
| Alias for foldl(). | |
| Acc | fold_left (const Acc &init, Op &&op) const |
| Overload of fold_left() 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() that accepts rvalues. | |
| Acc | foldr (const Acc &init, Op &op) const |
| Fold the elements from the last to the first. | |
| Acc | foldr (const Acc &init, Op &&op) const |
| Overload of foldr() that accepts rvalues. | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &op) const |
| Fold the elements with no initial value. | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &&op) const |
| Overload of reduce() that accepts rvalues. | |
| Aleph::DynList< T > | filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion. | |
| Aleph::DynList< T > | filter (Operation &&operation) const |
| Overload of filter() that accepts rvalues. | |
| Aleph::DynList< const T * > | ptr_filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and return a pointer to the matched items in the container. | |
| Aleph::DynList< const T * > | ptr_filter (Operation &&operation) const |
| Overload of ptr_filter() that accepts rvalues. | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and determine its positions respect to the traversal of container. | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &&operation) const |
| Overload of pfilter() that accepts rvalues. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &op) const |
| Exclusive partition of container according to a filter criterion. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &&op) const |
| Overload of partition() 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 criterion. | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &&op) const |
| Overload of tpartition() that accepts rvalues. | |
| size_t | length () const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< DynListStack< T >, T >) |
| 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 the elements at positions i, i + step, i + 2 step, ... that are not greater than j, respect to the traversal order. | |
| Aleph::DynList< T > | drop (const size_t n) const |
| Drop the first n elements seen in the container during its traversal. | |
| Aleph::DynList< T > | take_while (Operation &op) const |
| The longest prefix of elements that satisfy a criterion. | |
| Aleph::DynList< T > | take_while (Operation &&op) const |
| Overload of take_while() that accepts rvalues. | |
| Aleph::DynList< T > | drop_while (Operation &op) const |
| The elements after the longest prefix that satisfies a criterion. | |
| Aleph::DynList< T > | drop_while (Operation &&op) const |
| Overload of drop_while() that accepts rvalues. | |
| 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 |
See items(). | |
Public Member Functions inherited from EqualSequenceMethod< DynListStack< T > > | |
| bool | equal_to (const DynListStack< T > &r) const |
Equality test between this and r. | |
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 |
Additional Inherited Members | |
Static Public Member Functions inherited from FunctionalMethods< DynListStack< T >, T > | |
| static DynListStack< T > | build (Items &&... items) |
| Build a container that holds the given items. | |
| static D | build_as (Items &&... items) |
Build a D, a class derived from the container, holding the given items. | |
Public Attributes inherited from FunctionalMethods< DynListStack< T >, T > | |
| and | |
| Insert a new element into the container by constructing it from the given args. | |
| and Aleph::InvocableWith< Operation &, const T & > | and |
| Conditional mapping of the elements of the container. | |
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 105 of file tpl_dynListStack.H.
| using Aleph::DynListStack< T >::Const_Iterator = Aleph::Const_Iterator<Iterator> |
Read-only iterator: the iterator of a constant container.
Definition at line 550 of file tpl_dynListStack.H.
| using Aleph::DynListStack< T >::Item_Type = T |
The type of elements stored in the stack.
Definition at line 120 of file tpl_dynListStack.H.
| using Aleph::DynListStack< T >::Key_Type = T |
Alias for Item_Type.
Definition at line 123 of file tpl_dynListStack.H.
| using Aleph::DynListStack< T >::Set_Type = DynListStack |
The container type (self-reference for generic programming).
Definition at line 117 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 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.
|
inline |
Alias for push() - required by Special_Ctors macro.
| [in] | data | The item to append. |
Definition at line 298 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
Referenced by TEST().
|
inline |
See append(const T & data).
Definition at line 301 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
|
inlinenoexcept |
Empties the container.
| none |
Definition at line 405 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::empty().
|
inlinenoexcept |
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 487 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 289 of file tpl_dynListStack.H.
References 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 395 of file tpl_dynListStack.H.
References Aleph::DynList< T >::empty(), 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 345 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::pop().
Referenced by Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::augment_blossom(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::check_blossom(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().
|
inlinenoexcept |
Alias for contains().
Definition at line 494 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::contains().
|
inline |
Alias for push() - for STL-like insert semantics.
| [in] | data | The item to insert. |
Definition at line 316 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
|
inline |
See insert(const T & data).
Definition at line 319 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
|
inlinenoexcept |
Check if the stack is empty.
Time complexity: O(1)
Definition at line 237 of file tpl_dynListStack.H.
References Aleph::HTList::is_empty(), and Aleph::DynListStack< T >::s.
Referenced by Aleph::Gen_Centroid_Decomposition< GT, SA >::append_centroid_annotations(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::augment_blossom(), brute_path_distinct(), brute_subtree_distinct(), Aleph::Gen_Mo_On_Trees< GT, Policy >::build(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::build(), Aleph::Gen_Centroid_Decomposition< GT, SA >::build_centroid_tree(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::build_decomposition(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::tree_dp_detail::Tree_Topology< GT, SA >::build_order(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::check_blossom(), Aleph::Gen_Centroid_Decomposition< GT, SA >::collect_component_nodes(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::connected_components(), demo_comparison(), demo_stack(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::dfs(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::for_each_path_segment_id(), 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(), TEST(), TEST(), TEST(), TEST(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::test_connectivity(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and Aleph::tree_decomposition_detail::Rooted_Tree_Topology< GT, SA >::validate_connected_acyclic().
|
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 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 217 of file tpl_dynListStack.H.
References 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 381 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::top().
|
inline |
Alias for top() const - returns const reference to top item.
| std::underflow_error | If the stack is empty. |
Definition at line 387 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)
The item moves out before it leaves the stack, so that if its move throws the stack keeps it, and its size.
| std::underflow_error | If the stack is empty. |
Definition at line 336 of file tpl_dynListStack.H.
References Aleph::DynList< T >::remove_first(), and Aleph::DynListStack< T >::s.
Referenced by Aleph::Gen_Centroid_Decomposition< GT, SA >::append_centroid_annotations(), brute_path_distinct(), brute_subtree_distinct(), Aleph::Gen_Mo_On_Trees< GT, Policy >::build(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::build(), Aleph::Gen_Centroid_Decomposition< GT, SA >::build_centroid_tree(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::build_decomposition(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::tree_dp_detail::Tree_Topology< GT, SA >::build_order(), Aleph::Gen_Centroid_Decomposition< GT, SA >::collect_component_nodes(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), demo_comparison(), demo_stack(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::dfs(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::for_each_path_segment_id(), Aleph::DynListStack< T >::get(), main(), 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(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and Aleph::tree_decomposition_detail::Rooted_Tree_Topology< GT, SA >::validate_connected_acyclic().
|
inline |
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 250 of file tpl_dynListStack.H.
References Aleph::DynList< T >::insert(), and Aleph::DynListStack< T >::s.
Referenced by StringStack::StringStack(), Aleph::DynListStack< T >::append(), Aleph::DynListStack< T >::append(), Aleph::Gen_Centroid_Decomposition< GT, SA >::append_centroid_annotations(), brute_path_distinct(), brute_subtree_distinct(), Aleph::Gen_Mo_On_Trees< GT, Policy >::build(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::build(), Aleph::Gen_Centroid_Decomposition< GT, SA >::build_centroid_tree(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::build_decomposition(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::tree_dp_detail::Tree_Topology< GT, SA >::build_order(), Aleph::Gen_Centroid_Decomposition< GT, SA >::collect_component_nodes(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), demo_comparison(), demo_stack(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::dfs(), Aleph::DynListStack< T >::emplace(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::for_each_path_segment_id(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::init_node_and_push_in_stack(), Aleph::DynListStack< T >::insert(), Aleph::DynListStack< T >::insert(), main(), 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(), 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(), and Aleph::tree_decomposition_detail::Rooted_Tree_Topology< GT, SA >::validate_connected_acyclic().
|
inline |
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 265 of file tpl_dynListStack.H.
References Aleph::DynList< T >::insert(), and Aleph::DynListStack< T >::s.
|
inline |
Alias for push() - for compatibility with queue-like interfaces.
| [in] | data | The item to put. |
Definition at line 307 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
Referenced by Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::augment_blossom(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::check_blossom(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
See put(const T & data).
Definition at line 310 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::push().
|
inlinenoexcept |
See search(const T & key).
Definition at line 474 of file tpl_dynListStack.H.
References LocateFunctions< DynListStack< T >, T >::find_ptr().
|
inlinenoexcept |
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. |
Definition at line 467 of file tpl_dynListStack.H.
References LocateFunctions< DynListStack< T >, T >::find_ptr().
Referenced by Aleph::DynListStack< T >::contains(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().
|
inlinenoexcept |
Return the number of elements in the stack.
Time complexity: O(1)
Definition at line 229 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::s, and Aleph::DynList< T >::size().
Referenced by Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::check_blossom(), 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(), 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(), 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 135 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::s, and Aleph::DynList< T >::swap().
Referenced by Aleph::DynListStack< T >::DynListStack(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), 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 358 of file tpl_dynListStack.H.
References Aleph::DynList< T >::get_first(), and Aleph::DynListStack< T >::s.
Referenced by Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::augment_blossom(), Aleph::Gen_Mo_On_Trees< GT, Policy >::build(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::build(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::build_decomposition(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_dfs_data(), Aleph::tree_dp_detail::Tree_Topology< GT, SA >::build_order(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::check_blossom(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_sizes_and_parents(), demo_stack(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::dfs(), 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(), 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(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and Aleph::tree_decomposition_detail::Rooted_Tree_Topology< GT, SA >::validate_connected_acyclic().
|
inline |
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 372 of file tpl_dynListStack.H.
References Aleph::DynList< T >::get_first(), and Aleph::DynListStack< T >::s.
|
inlinenoexcept |
See traverse(Operation & operation).
Definition at line 440 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::s, and GenericTraverse< Container >::traverse().
|
inlinenoexcept |
See traverse(Operation & operation).
Definition at line 449 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::s, and GenericTraverse< Container >::traverse().
|
inlinenoexcept |
See traverse(Operation & operation).
Definition at line 431 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::s, and GenericTraverse< Container >::traverse().
|
inlinenoexcept |
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.Definition at line 422 of file tpl_dynListStack.H.
References Aleph::DynListStack< T >::s, and GenericTraverse< Container >::traverse().
|
private |
Definition at line 112 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(), 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().