Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::DynDlist< T > Class Template Reference

Dynamic doubly linked list with O(1) size and bidirectional access. More...

#include <tpl_dynDlist.H>

Inheritance diagram for Aleph::DynDlist< T >:
[legend]
Collaboration diagram for Aleph::DynDlist< T >:
[legend]

Classes

class  Iterator
 Iterator dynamic list. More...
 

Public Types

using Set_Type = DynDlist
 The type of container.
 
using Item_Type = T
 The type of element that stores the container.
 
using Key_Type = T
 The type of element that stores the container.
 
using Const_Iterator = Aleph::Const_Iterator< Iterator >
 Read-only iterator: the iterator of a constant container.
 
- Public Types inherited from Aleph::Dnode< T >
using key_type = T
 The data type.
 
- Public Types inherited from StlAlephIterator< SetName >
using iterator = StlIterator< SetName >
 
using const_iterator = StlConstIterator< SetName >
 

Public Member Functions

const size_t & size () const noexcept
 Return the number of elements (constant time)
 
 DynDlist ()=default
 
template<template< typename > class List>
 DynDlist (const List< T > &l)
 
template<class It >
requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; })
 DynDlist (It b, It e)
 
 DynDlist (std::initializer_list< T > l)
 
void empty () noexcept
 @brief Empties the container.
 
void clear () noexcept
 @brief Empties the container.
 
 ~DynDlist ()
 Destructor.
 
T & insert (const T &item)
 Insert a copy of item at the beginning of the list.
 
T & insert (T &&item)
 Insert a moved item at the beginning of the list.
 
T & append (const T &item)
 Append a copied item at the end of the list.
 
T & append (T &&item)
 Append a moved item at the end of the list.
 
void insert (const DynDlist &list)
 Insert all the elements of list before this.
 
void insert (DynDlist &&list) noexcept
 See insert(const DynDlist & list).
 
void append (const DynDlist &list)
 Append all the elements of list after this.
 
void append (DynDlist &&list) noexcept
 See append(const DynDlist & list).
 
T & get_first_ne () noexcept
 Return a modifiable reference to first item in the list.
 
const T & get_first_ne () const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
 
T & get_last_ne () noexcept
 Return a modifiable reference to last item in the list.
 
const T & get_last_ne () const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
 
T & get_first ()
 Return a modifiable reference to first item in the list.
 
const T & get_first () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
 
T & get_last ()
 Return a modifiable reference to last item in the list.
 
const T & get_last () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
 
T remove_first_ne () noexcept(std::is_nothrow_move_constructible_v< T >)
 Remove the first item of the list, which must not be empty.
 
T remove_last_ne () noexcept(std::is_nothrow_move_constructible_v< T >)
 Remove the last item of the list, which must not be empty.
 
T remove_first ()
 Remove the first item of the list; return a copy of removed item.
 
T remove_last ()
 Remove the last item of the list; return a copy of removed item.
 
T & put (const T &item)
 See append(const T & item).
 
T & put (T &&item)
 See append(T && item).
 
T get ()
 See remove_first().
 
T & rear ()
 If this was treated as a queue, the it returns the most recently inserted item.
 
T & front ()
 If this was treated as a queue, the it returns the most oldlest inserted item.
 
T & push (const T &item)
 See insert(const T & item).
 
T & push (T &&item)
 See insert(T && item).
 
T pop ()
 See remove_first().
 
T & top ()
 See get_first().
 
const T & top () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.
 
void remove (T &data) noexcept
 Assuming that data is a reference to the item in the list, it removes the item.
 
void erase (T &data) noexcept
 See remove(T & data).
 
void swap (DynDlist &l) noexcept
 Swap in constant time all the items of this with all the items of l (very fast!)
 
void split_list_ne (DynDlist &l, DynDlist &r) noexcept
 Split the list in two.
 
void split_list (DynDlist &l, DynDlist &r)
 Split the list in two.
 
void split (DynDlist &l, DynDlist &r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Alias for split_list.
 
DynDlist< T > & operator= (const DynDlist &list)
 Assignment by copy.
 
 DynDlist (const DynDlist &list)
 Copy constructor; all items of list are copied.
 
 DynDlist (DynDlist &&list) noexcept
 Move constructor: takes in constant time the items of list, which is left empty.
 
 DynDlist (DynDlist &&list) noexcept(std::is_nothrow_move_constructible_v< T >)
 Move constructor for a T whose default construction may throw, as one that allocates, and that can be moved: takes in constant time the items of list, which is left empty.
 
 DynDlist (DynDlist &&list)
 Move constructor for a T whose default construction may throw and that cannot be moved, as one whose move constructor is deleted: takes in constant time the items of list, which is left empty.
 
DynDlist< T > & operator= (DynDlist &&list) noexcept
 Assignment by moving.
 
T & operator[] (const size_t n)
 Return a modifiable reference to the i-th item of the list.
 
const T & operator[] (const size_t n) const
 Return a reference to const to the i-th item of the list.
 
DynDlist & reverse () noexcept
 
DynDlist & rev () noexcept
 
DynDlist< T > reverse () const
 Return a reversed copy of this
 
DynDlist< T > rev () const
 
- Public Member Functions inherited from Aleph::Dnode< T >
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 GenericTraverse< Container >
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_arg<Container, Operation>::type>
bool traverse (Operation &operation) noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_arg< Container, Operation >::type, Container & >())
 Traverse the container via its iterator and performs a conditioned operation on each item.
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_carg<Container, Operation>::type>
bool traverse (Operation &operation) const noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_carg< Container, Operation >::type, const_source_t< Operation > >())
 Traverse a constant container; each item is handed out as a constant reference.
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_carg<Container, Operation>::type>
bool traverse (Operation &&operation) const noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_carg< Container, Operation >::type, const_source_t< Operation > >())
 Overload of traverse(Operation &) const that accepts rvalues.
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_arg<Container, Operation>::type>
bool traverse (Operation &&operation) noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_arg< Container, Operation >::type, Container & >())
 Overload of traverse(Operation &) that accepts rvalues.
 
- Public Member Functions inherited from SpecialCtors< Container, T >
 SpecialCtors ()=default
 Default constructor; it appends nothing.
 
 SpecialCtors (const SpecialCtors &)=default
 Copy constructor; the derived container copies its items.
 
 SpecialCtors (SpecialCtors &&) noexcept
 Move constructor; the derived container moves its items.
 
SpecialCtors & operator= (const SpecialCtors &)=default
 Copy assignment; the derived container copies its items.
 
SpecialCtors & operator= (SpecialCtors &&) noexcept
 Move assignment; the derived container moves its items.
 
 SpecialCtors (const Aleph::DynList< T > &l)
 Build the container by inserting all items of the list l.
 
template<class It >
requires (not std::is_arithmetic_v<It> and requires(It it) { *it; ++it; it != it; })
 SpecialCtors (It b, It e)
 Construct the container from a range of iterators.
 
 SpecialCtors (std::initializer_list< T > l)
 Construct the container from an initializer list.
 
- Public Member Functions inherited from LocateFunctions< Container, Type >
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().
 
template<class C = Container>
requires Aleph::dry_detail::MutablyTraversable<C, Type>
Type & nth_ne (const size_t n) noexcept(Aleph::dry_detail::mutable_traversal_is_noexcept< C, Type >)
 Return the n‑th element without bounds checking.
 
const Type & nth_ne (const size_t n) const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< Container, Type >)
 Constant overload of nth_ne(size_t).
 
template<class C = Container>
requires Aleph::dry_detail::MutablyTraversable<C, Type>
Type & nth (const size_t n)
 Return the n-th item of the container.
 
const Type & nth (const size_t n) const
 Const overload of nth(size_t).
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, Type &>
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, Type > Type * find_ptr (Operation &operation) noexcept(mutable_search_is_noexcept< Operation >())
 Find a pointer to an item in the container according to a searching criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
const Type * find_ptr (Operation &operation) const noexcept(const_search_is_noexcept< Operation >())
 Const overload of find_ptr(Operation&).
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
const Type * find_ptr (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >())
 Overload of find_ptr() const that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, Type &>
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, Type > Type * find_ptr (Operation &&operation) noexcept(mutable_search_is_noexcept< Operation >())
 Overload of find_ptr() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
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.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
size_t find_index (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >())
 Overload of find_index() that accepts rvalues.
 
template<class Operation , class T = Type>
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, Type > find_item (Operation &operation) const noexcept(find_item_is_noexcept< Operation >())
 Safe sequential searching of an item matching a criterion.
 
template<class Operation , class T = Type>
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, Type > find_item (Operation &&operation) const noexcept(find_item_is_noexcept< Operation >())
 Overload of find_item() that accepts rvalues.
 
template<class Operation , class T = Type>
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
and std::copy_constructible< T > std::optional< Type > find_opt (Operation &operation) const
 Copy of the first item satisfying a criterion, if any.
 
template<class Operation , class T = Type>
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
and std::copy_constructible< T > std::optional< Type > find_opt (Operation &&operation) const
 Overload of find_opt() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const Type &>
bool contains_if (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >())
 Test if an item satisfying a criterion is present in the container.
 
template<class T = Type>
requires requires(const T & a, const T & b) { { a == b } -> std::convertible_to<bool>; }
bool contains (const Type &item) const
 Test if an item is present in the container using equality.
 
- Public Member Functions inherited from FunctionalMethods< Container, 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)
 
template<typename... Args>
requires ((std::convertible_to<Args &&, T> and ...) and (Aleph::InsertableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type, Item_Arg<Args>> and ...))
size_t ninsert (Args &&... args)
 Insert n variadic items.
 
template<typename... Args>
requires ((std::convertible_to<Args &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type, Item_Arg<Args>> and ...))
size_t nappend (Args &&... args)
 Append n variadic items.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, const T &>
void for_each (Operation &operation) const
 Traverse all the container and performs an operation on each element.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, const T &>
void for_each (Operation &&operation) const
 Overload of for_each() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, const T &>
void each (Operation &operation) const
 Alias of for_each().
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, const T &>
void each (Operation &&operation) const
 Alias of for_each() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, const T &>
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.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, const T &>
void each (const size_t pos, const size_t slice, Operation &&operation) const
 See each(size_t pos, size_t slice, Operation & operation) const.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, T &>
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, 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.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, T &>
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, 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).
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, T &>
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void mutable_for_each (Operation &operation)
 Apply a mutable operation to each element of the container.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, T &>
and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< Container, Operation >::type, T > void mutable_for_each (Operation &&operation)
 See mutable_for_each(Operation & operation).
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
bool all (Operation &operation) const
 Check if all the elements of the container satisfy a condition.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
bool all (Operation &&operation) const
 Overload of all() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
bool exists (Operation &op) const
 Test for existence in the container of an element satisfying a criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
bool exists (Operation &&op) const
 Overload of exists() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
bool none (Operation &op) const
 Test that no element satisfies a criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
bool none (Operation &&op) const
 Overload of none() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
size_t count_if (Operation &op) const
 Count the elements that satisfy a criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
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
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, const T &>
auto flat_map (Operation &op) const
 Map each element to a container and concatenate the results.
 
template<class Operation >
requires Aleph::InvocableWith<Operation &, const T &>
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.
 
template<typename Acc = T, class Op >
requires Aleph::dry_detail::FoldOperation<Op, Acc, T>
Acc foldl (const Acc &init, Op &op) const
 Fold the elements of the container to a specific result.
 
template<typename Acc = T, class Op >
requires Aleph::dry_detail::FoldOperation<Op, Acc, T>
Acc foldl (const Acc &init, Op &&op) const
 Overload of foldl() that accepts rvalues.
 
template<typename Acc = T, class Op >
requires Aleph::dry_detail::FoldOperation<Op, Acc, T>
Acc fold_left (const Acc &init, Op &op) const
 Alias for foldl().
 
template<typename Acc = T, class Op >
requires Aleph::dry_detail::FoldOperation<Op, Acc, T>
Acc fold_left (const Acc &init, Op &&op) const
 Overload of fold_left() that accepts rvalues.
 
template<class Operation >
requires Aleph::dry_detail::FoldOperation<Operation, T, T>
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.
 
template<class Operation >
requires Aleph::dry_detail::FoldOperation<Operation, T, T>
T fold (const T &init, Operation &&operation) const
 Overload of fold() that accepts rvalues.
 
template<typename Acc = T, class Op >
requires Aleph::dry_detail::FoldRightOperation<Op, Acc, T>
Acc foldr (const Acc &init, Op &op) const
 Fold the elements from the last to the first.
 
template<typename Acc = T, class Op >
requires Aleph::dry_detail::FoldRightOperation<Op, Acc, T>
Acc foldr (const Acc &init, Op &&op) const
 Overload of foldr() that accepts rvalues.
 
template<class Op , class U = T>
requires Aleph::dry_detail::FoldOperation<Op, T, T>
and std::copy_constructible< U > std::optional< T > reduce (Op &op) const
 Fold the elements with no initial value.
 
template<class Op , class U = T>
requires Aleph::dry_detail::FoldOperation<Op, T, T>
and std::copy_constructible< U > std::optional< T > reduce (Op &&op) const
 Overload of reduce() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
Aleph::DynList< T > filter (Operation &operation) const
 Filter the elements of a container according to a matching criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
Aleph::DynList< T > filter (Operation &&operation) const
 Overload of filter() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
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.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
Aleph::DynList< const T * > ptr_filter (Operation &&operation) const
 Overload of ptr_filter() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
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.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &&operation) const
 Overload of pfilter() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &op) const
 Exclusive partition of container according to a filter criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
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.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &op) const
 Exclusive partition of container according to a filter criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
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< Container, 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.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
Aleph::DynList< T > take_while (Operation &op) const
 The longest prefix of elements that satisfy a criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
Aleph::DynList< T > take_while (Operation &&op) const
 Overload of take_while() that accepts rvalues.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
Aleph::DynList< T > drop_while (Operation &op) const
 The elements after the longest prefix that satisfies a criterion.
 
template<class Operation >
requires Aleph::InvocablePredicateWith<Operation &, const T &>
Aleph::DynList< T > drop_while (Operation &&op) const
 Overload of drop_while() that accepts rvalues.
 
template<class C = Container>
requires requires (C & c) { c.remove(); }
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< Container >
bool equal_to (const Container &r) const
 Equality test between this and r.
 
- Public Member Functions inherited from StlAlephIterator< SetName >
iterator begin () noexcept
 Return an STL-compatible iterator to the first element.
 
iterator end () noexcept
 Return an STL-compatible end iterator.
 
const_iterator begin () const noexcept
 Return a const iterator to the first element.
 
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 Member Functions

T & _insert (Dnode< T > *p) noexcept
 
T & _append (Dnode< T > *p) noexcept
 
void _insert (DynDlist< T > &list) noexcept
 
void _append (DynDlist< T > &list) noexcept
 
template<bool First>
void delete_end () noexcept
 
template<bool First>
T remove_end_ne () noexcept(std::is_nothrow_move_constructible_v< T >)
 

Private Attributes

size_t num_elem = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from Aleph::Dnode< T >
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.
 
- Static Public Member Functions inherited from FunctionalMethods< Container, T >
template<typename... Items>
requires ((std::convertible_to<Items &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<Items...>>::type, Item_Arg<Items>> and ...))
static Container build (Items &&... items)
 Build a container that holds the given items.
 
template<class D , typename... Items>
requires (std::derived_from<D, typename Aleph::concepts_detail::defer<Container, D>::type> and std::default_initializable<D> and (std::convertible_to<Items &&, T> and ...) and (Aleph::AppendableWith<typename Aleph::concepts_detail::defer<Container, std::tuple<D, Items...>>::type, Item_Arg<Items>> and ...))
static D build_as (Items &&... items)
 Build a D, a class derived from the container, holding the given items.
 
- Public Attributes inherited from FunctionalMethods< Container, T >
template<typename... Args>
requires (typename Aleph::concepts_detail::defer<Container, std::tuple<Args...>>::type & c, T && x)
 and { c.append(std::move(x))
 Insert a new element into the container by constructing it from the given args.
 
template<typename R = void, class Prop , class Operation >
requires (Aleph::DynList<Aleph::dry_detail::map_result_t<R, Operation &, T>> & l, Operation & op, const T & item)
and Aleph::InvocableWith< Operation &, const T & > and { l.append(std::invoke(op, item))
 Conditional mapping of the elements of the container.
 

Detailed Description

template<typename T = int>
class Aleph::DynDlist< T >

Dynamic doubly linked list with O(1) size and bidirectional access.

DynDlist<T> is a doubly linked circular list that maintains a count of elements, enabling O(1) size queries. Unlike DynList (singly linked), DynDlist supports efficient operations at both ends and bidirectional iteration.

This container combines the flexibility of linked lists with a rich set of functional programming operations inherited from FunctionalMethods.

Template Parameters
TThe type of elements stored in the list (default: int).
Complexity:
Key Features:
  • O(1) insertion/removal at both ends
  • O(1) size query (unlike DynList)
  • Bidirectional iteration
  • Comprehensive functional operations (map, filter, fold, etc.)
  • Support for initializer lists and range construction
Example:
DynDlist<int> list = {1, 2, 3, 4, 5};
// O(1) operations
list.insert(0); // Insert at head
list.append(6); // Insert at tail
auto first = list.remove_first();
auto last = list.remove_last();
// Functional operations
auto doubled = list.maps<int>([](int x) { return x * 2; });
int sum = list.foldl(0, [](int acc, int x) { return acc + x; });
// Bidirectional iteration
for (auto it = list.get_it(); it.has_curr(); it.next())
std::cout << it.get_curr() << " ";
for (auto it = list.get_last_it(); it.has_curr(); it.prev())
std::cout << it.get_curr() << " ";
Dynamic doubly linked list with O(1) size and bidirectional access.
T remove_first()
Remove the first item of the list; return a copy of removed item.
T & append(const T &item)
Append a copied item at the end of the list.
T remove_last()
Remove the last item of the list; return a copy of removed item.
T & insert(const T &item)
Insert a copy of item at the beginning of the list.
Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > maps(Operation &op) const
Definition ah-dry.H:1829
Acc foldl(const Acc &init, Op &op) const
Fold the elements of the container to a specific result.
Definition ah-dry.H:2145
auto get_it()
Return a properly initialized iterator positioned at the first item on the container.
Definition ah-dry.H:663
Note
The size is maintained automatically, so size() is O(1).
This is a circular doubly linked list with a sentinel header.
See also
DynList Singly linked list alternative (no size counter).
Dlink Low-level doubly linked list node.
FunctionalMethods Inherited functional operations.
Examples
blossom_example.cc.

Definition at line 117 of file tpl_dynDlist.H.

Member Typedef Documentation

◆ Const_Iterator

template<typename T = int>
using Aleph::DynDlist< T >::Const_Iterator = Aleph::Const_Iterator<Iterator>

Read-only iterator: the iterator of a constant container.

Definition at line 850 of file tpl_dynDlist.H.

◆ Item_Type

template<typename T = int>
using Aleph::DynDlist< T >::Item_Type = T

The type of element that stores the container.

Definition at line 133 of file tpl_dynDlist.H.

◆ Key_Type

template<typename T = int>
using Aleph::DynDlist< T >::Key_Type = T

The type of element that stores the container.

Definition at line 136 of file tpl_dynDlist.H.

◆ Set_Type

template<typename T = int>
using Aleph::DynDlist< T >::Set_Type = DynDlist

The type of container.

Definition at line 130 of file tpl_dynDlist.H.

Constructor & Destructor Documentation

◆ DynDlist() [1/8]

template<typename T = int>
Aleph::DynDlist< T >::DynDlist ( )
default

◆ DynDlist() [2/8]

template<typename T = int>
template<template< typename > class List>
Aleph::DynDlist< T >::DynDlist ( const List< T > &  l)
inline

Definition at line 156 of file tpl_dynDlist.H.

◆ DynDlist() [3/8]

template<typename T = int>
template<class It >
requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; })
Aleph::DynDlist< T >::DynDlist ( It  b,
It  e 
)
inline

Definition at line 156 of file tpl_dynDlist.H.

◆ DynDlist() [4/8]

template<typename T = int>
Aleph::DynDlist< T >::DynDlist ( std::initializer_list< T >  l)
inline

Definition at line 156 of file tpl_dynDlist.H.

◆ ~DynDlist()

template<typename T = int>
Aleph::DynDlist< T >::~DynDlist ( )
inline

Destructor.

Definition at line 186 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::empty().

◆ DynDlist() [5/8]

template<typename T = int>
Aleph::DynDlist< T >::DynDlist ( const DynDlist< T > &  list)
inline

Copy constructor; all items of list are copied.

The construction time is proportional to the number of items of list

Parameters
[in]listto be copied
Exceptions
bad_allocif there is no enough memory

Definition at line 881 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::append(), Aleph::Dlink::Iterator::has_curr(), and Aleph::Dlink::is_empty().

◆ DynDlist() [6/8]

template<typename T = int>
Aleph::DynDlist< T >::DynDlist ( DynDlist< T > &&  list)
inlinenoexcept

Move constructor: takes in constant time the items of list, which is left empty.

The header node of a list holds an item. This is the constructor for a T whose default construction cannot throw: the item of the new header node is built so.

Parameters
[in,out]listthe list to move from.

Definition at line 898 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::swap().

◆ DynDlist() [7/8]

template<typename T = int>
Aleph::DynDlist< T >::DynDlist ( DynDlist< T > &&  list)
inlinenoexcept

Move constructor for a T whose default construction may throw, as one that allocates, and that can be moved: takes in constant time the items of list, which is left empty.

The header node of the new list takes the place of that of list, and its item by a move, so that no item is built.

Parameters
[in,out]listthe list to move from.
Exceptions
whatthe move constructor of T throws, for the item of the header node; nothing when it is noexcept. Then list keeps its items.

Definition at line 917 of file tpl_dynDlist.H.

◆ DynDlist() [8/8]

template<typename T = int>
Aleph::DynDlist< T >::DynDlist ( DynDlist< T > &&  list)
inline

Move constructor for a T whose default construction may throw and that cannot be moved, as one whose move constructor is deleted: takes in constant time the items of list, which is left empty.

The item of the header node cannot be taken from that of list, so it is built by default.

Parameters
[in,out]listthe list to move from.
Exceptions
whatthe default construction of T throws, for the item of the header node. Then list keeps its items.

Definition at line 937 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::swap().

Member Function Documentation

◆ _append() [1/2]

template<typename T = int>
T & Aleph::DynDlist< T >::_append ( Dnode< T > *  p)
inlineprivatenoexcept

◆ _append() [2/2]

template<typename T = int>
void Aleph::DynDlist< T >::_append ( DynDlist< T > &  list)
inlineprivatenoexcept

Definition at line 261 of file tpl_dynDlist.H.

References Aleph::Dlink::append_list(), and Aleph::DynDlist< T >::num_elem.

◆ _insert() [1/2]

template<typename T = int>
T & Aleph::DynDlist< T >::_insert ( Dnode< T > *  p)
inlineprivatenoexcept

◆ _insert() [2/2]

template<typename T = int>
void Aleph::DynDlist< T >::_insert ( DynDlist< T > &  list)
inlineprivatenoexcept

Definition at line 252 of file tpl_dynDlist.H.

References Aleph::Dlink::insert_list(), and Aleph::DynDlist< T >::num_elem.

◆ append() [1/4]

template<typename T = int>
void Aleph::DynDlist< T >::append ( const DynDlist< T > &  list)
inline

Append all the elements of list after this.

Parameters
[in]listto insert after this

Definition at line 291 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::_append(), and l.

◆ append() [2/4]

template<typename T = int>
T & Aleph::DynDlist< T >::append ( const T &  item)
inline

Append a copied item at the end of the list.

Parameters
[in]itemto be copied and appended at the end of the list
Returns
a modifiable reference to the appended item in the list
Exceptions
bad_allocif there is no memory for the new item.

Definition at line 235 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::_append().

Referenced by Aleph::DynDlist< T >::DynDlist(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::augment_blossom_rec(), Aleph::Compute_Cut_Nodes< GT, SA >::compute_blocks(), Aleph::compute_maximum_cardinality_bipartite_matching(), Aleph::compute_maximum_cardinality_general_matching(), Aleph::compute_maximum_weight_general_matching(), Aleph::compute_min_cut(), Aleph::compute_nodes_in_level_helper(), Aleph::Compute_Cut_Nodes< GT, SA >::cut_nodes(), Aleph::Compute_Cut_Nodes< GT, SA >::cut_nodes(), demo_bfs_topological_sort(), demo_dynlist(), Aleph::dynarray_to_DynDlist(), Aleph::dynlist_to_DynDlist(), Aleph::edge_connectivity(), Aleph::hopcroft_karp_matching(), Aleph::init_to_DynDlist(), Aleph::Compute_Cut_Nodes< GT, SA >::map_cut_graph(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::non_feasible_nodes(), Aleph::HalfPlaneIntersection::operator()(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::operator()(), Aleph::DynDlist< T >::operator=(), orden_ejecucion(), Eepic_Plane::put(), Aleph::DynDlist< T >::put(), Aleph::DynDlist< T >::put(), DynDlistSortTest::SetUp(), Aleph::split(), 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(), 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(), to_dyndlist(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::trace_alternating_paths(), Aleph::vector_to_DynDlist(), Aleph::vector_to_DynDlist(), and Aleph::vertex_connectivity().

◆ append() [3/4]

template<typename T = int>
void Aleph::DynDlist< T >::append ( DynDlist< T > &&  list)
inlinenoexcept

See append(const DynDlist & list).

Definition at line 298 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::_append().

◆ append() [4/4]

template<typename T = int>
T & Aleph::DynDlist< T >::append ( T &&  item)
inline

Append a moved item at the end of the list.

Parameters
[in]itemto be moved and appended at the end of the list
Returns
a modifiable reference to the appended item in the list
Exceptions
bad_allocif there is no memory for the new element.

Definition at line 246 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::_append().

◆ clear()

template<typename T = int>
void Aleph::DynDlist< T >::clear ( )
inlinenoexcept

@brief Empties the container.

This is an alias of empty().

Exceptions
none
See also
empty()

Definition at line 181 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::empty().

◆ delete_end()

template<typename T = int>
template<bool First>
void Aleph::DynDlist< T >::delete_end ( )
inlineprivatenoexcept

◆ empty()

template<typename T = int>
void Aleph::DynDlist< T >::empty ( )
inlinenoexcept

@brief Empties the container.

Removes all elements from the list, leaving it empty. This operation is performed in O(n) time, where n is the number of elements in the list.

Exceptions
noneEmpty the list

Definition at line 166 of file tpl_dynDlist.H.

References Aleph::Dlink::is_empty(), and Aleph::Dnode< T >::remove_next().

Referenced by Aleph::DynDlist< T >::~DynDlist(), Aleph::DynDlist< T >::clear(), Aleph::compute_maximum_cardinality_general_matching(), Aleph::compute_maximum_weight_general_matching(), Aleph::compute_min_cut(), Aleph::compute_minimum_cost_perfect_general_matching(), Aleph::Compute_Cut_Nodes< GT, SA >::cut_nodes(), Aleph::DynDlist< T >::operator=(), TEST(), TEST_F(), and to_dyndlist().

◆ erase()

template<typename T = int>
void Aleph::DynDlist< T >::erase ( T &  data)
inlinenoexcept

See remove(T & data).

Definition at line 543 of file tpl_dynDlist.H.

References Aleph::Dnode< T >::data, and Aleph::DynDlist< T >::remove().

Referenced by TEST().

◆ front()

template<typename T = int>
T & Aleph::DynDlist< T >::front ( )
inline

If this was treated as a queue, the it returns the most oldlest inserted item.

Definition at line 485 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::get_first().

Referenced by TEST().

◆ get()

template<typename T = int>
T Aleph::DynDlist< T >::get ( )
inline

◆ get_first() [1/2]

◆ get_first() [2/2]

template<typename T = int>
const T & Aleph::DynDlist< T >::get_first ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.

Definition at line 338 of file tpl_dynDlist.H.

References ah_underflow_error_if, Aleph::DynDlist< T >::get_first_ne(), and Aleph::Dlink::is_empty().

◆ get_first_ne() [1/2]

template<typename T = int>
const T & Aleph::DynDlist< T >::get_first_ne ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.

Definition at line 311 of file tpl_dynDlist.H.

References Aleph::Dnode< T >::get_next().

◆ get_first_ne() [2/2]

template<typename T = int>
T & Aleph::DynDlist< T >::get_first_ne ( )
inlinenoexcept

Return a modifiable reference to first item in the list.

Definition at line 304 of file tpl_dynDlist.H.

References Aleph::Dnode< T >::get_next().

Referenced by Aleph::DynDlist< T >::get_first(), Aleph::DynDlist< T >::get_first(), and Aleph::DynDlist< T >::remove_end_ne().

◆ get_last() [1/2]

◆ get_last() [2/2]

template<typename T = int>
const T & Aleph::DynDlist< T >::get_last ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.

Definition at line 353 of file tpl_dynDlist.H.

References ah_underflow_error_if, Aleph::DynDlist< T >::get_last_ne(), and Aleph::Dlink::is_empty().

◆ get_last_ne() [1/2]

template<typename T = int>
const T & Aleph::DynDlist< T >::get_last_ne ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.

Definition at line 324 of file tpl_dynDlist.H.

References Aleph::Dnode< T >::get_prev().

◆ get_last_ne() [2/2]

template<typename T = int>
T & Aleph::DynDlist< T >::get_last_ne ( )
inlinenoexcept

Return a modifiable reference to last item in the list.

Definition at line 317 of file tpl_dynDlist.H.

References Aleph::Dnode< T >::get_prev().

Referenced by Aleph::DynDlist< T >::get_last(), Aleph::DynDlist< T >::get_last(), and Aleph::DynDlist< T >::remove_end_ne().

◆ insert() [1/4]

template<typename T = int>
void Aleph::DynDlist< T >::insert ( const DynDlist< T > &  list)
inline

Insert all the elements of list before this.

Parameters
[in]listinsert before this.

Definition at line 275 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::_insert(), and l.

◆ insert() [2/4]

template<typename T = int>
T & Aleph::DynDlist< T >::insert ( const T &  item)
inline

Insert a copy of item at the beginning of the list.

Parameters
[in]itemto be copied and inserted at the beginning
Returns
a modifiable reference to the inserted item in the list
Exceptions
bad_allocif there is no enough memory

Definition at line 213 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::_insert().

Referenced by main(), main(), Aleph::DynDlist< T >::push(), Aleph::DynDlist< T >::push(), Aleph::DynDlist< T >::reverse(), TEST(), TEST(), TEST(), TEST_F(), and Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::trace_alternating_paths().

◆ insert() [3/4]

template<typename T = int>
void Aleph::DynDlist< T >::insert ( DynDlist< T > &&  list)
inlinenoexcept

See insert(const DynDlist & list).

Definition at line 282 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::_insert().

◆ insert() [4/4]

template<typename T = int>
T & Aleph::DynDlist< T >::insert ( T &&  item)
inline

Insert a moved item at the beginning of the list.

Parameters
[in]itemto be moved and inserted at the beginning of the list
Returns
a modifiable reference to the inserted item in the list
Exceptions
bad_allocif there is no enough memory

Definition at line 224 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::_insert().

◆ operator=() [1/2]

template<typename T = int>
DynDlist< T > & Aleph::DynDlist< T >::operator= ( const DynDlist< T > &  list)
inline

Assignment by copy.

In this assignment this is emptied and the the items of list are copied to this. It takes since time proportional to the size of list more the old size of this

Parameters
[in]listto be copied
Exceptions
bad_allocif there is no enough memory

Definition at line 861 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::append(), Aleph::DynDlist< T >::empty(), and Aleph::Dlink::Iterator::has_curr().

◆ operator=() [2/2]

template<typename T = int>
DynDlist< T > & Aleph::DynDlist< T >::operator= ( DynDlist< T > &&  list)
inlinenoexcept

Assignment by moving.

In this assignment this is swapped with list. So, this takes constant time independently of list sizes.

Parameters
[in]listto be assigned by moving
Exceptions
bad_allocif there is no enough memory

Definition at line 953 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::swap().

◆ operator[]() [1/2]

template<typename T = int>
T & Aleph::DynDlist< T >::operator[] ( const size_t  n)
inline

Return a modifiable reference to the i-th item of the list.

Exceptions
out_of_rangeif n is greater than or equal to the list size.

Definition at line 961 of file tpl_dynDlist.H.

References ah_out_of_range_error_if, and LocateFunctions< Container, Type >::get_it().

◆ operator[]() [2/2]

template<typename T = int>
const T & Aleph::DynDlist< T >::operator[] ( const size_t  n) const
inline

Return a reference to const to the i-th item of the list.

Exceptions
out_of_rangeif n is greater than or equal to the list size.

Definition at line 974 of file tpl_dynDlist.H.

References ah_out_of_range_error_if, and LocateFunctions< Container, Type >::get_it().

◆ pop()

template<typename T = int>
T Aleph::DynDlist< T >::pop ( )
inline

See remove_first().

Definition at line 503 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::remove_first().

Referenced by TEST().

◆ push() [1/2]

template<typename T = int>
T & Aleph::DynDlist< T >::push ( const T &  item)
inline

See insert(const T & item).

Definition at line 491 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::insert().

Referenced by TEST().

◆ push() [2/2]

template<typename T = int>
T & Aleph::DynDlist< T >::push ( T &&  item)
inline

See insert(T && item).

Definition at line 497 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::insert().

◆ put() [1/2]

template<typename T = int>
T & Aleph::DynDlist< T >::put ( const T &  item)
inline

See append(const T & item).

Definition at line 459 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::append().

Referenced by Aleph::compute_bipartite(), and TEST().

◆ put() [2/2]

template<typename T = int>
T & Aleph::DynDlist< T >::put ( T &&  item)
inline

See append(T && item).

Definition at line 465 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::append().

◆ rear()

template<typename T = int>
T & Aleph::DynDlist< T >::rear ( )
inline

If this was treated as a queue, the it returns the most recently inserted item.

Definition at line 478 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::get_last().

Referenced by TEST().

◆ remove()

template<typename T = int>
void Aleph::DynDlist< T >::remove ( T &  data)
inlinenoexcept

Assuming that data is a reference to the item in the list, it removes the item.

This method can be more powerful given that allows to remove any item in constant time given a valid reference to it.

Warning
Unpredictable results if the reference is not valid. So be sure that you do not pass a reference to a copy of the item. It must be a reference to the item returned by some accessor methods of this class.
Parameters
[in]datavalid reference to the item in the list.

Definition at line 534 of file tpl_dynDlist.H.

References Aleph::Dnode< T >::data, Aleph::Dnode< T >::data_to_node(), Aleph::Dlink::del(), and Aleph::DynDlist< T >::num_elem.

Referenced by Aleph::DynDlist< T >::erase(), and TEST().

◆ remove_end_ne()

template<typename T = int>
template<bool First>
T Aleph::DynDlist< T >::remove_end_ne ( )
inlineprivatenoexcept

◆ remove_first()

template<typename T = int>
T Aleph::DynDlist< T >::remove_first ( )
inline

◆ remove_first_ne()

template<typename T = int>
T Aleph::DynDlist< T >::remove_first_ne ( )
inlinenoexcept

Remove the first item of the list, which must not be empty.

The item moves out before its node leaves, so that if its move throws the list keeps it.

Returns
the removed item

Definition at line 419 of file tpl_dynDlist.H.

Referenced by Eepic_Plane::~Eepic_Plane(), Aleph::DynDlist< T >::remove_first(), TEST(), TEST(), and TEST().

◆ remove_last()

template<typename T = int>
T Aleph::DynDlist< T >::remove_last ( )
inline

Remove the last item of the list; return a copy of removed item.

Returns
a copy of removed item
Exceptions
underflow_errorif this is empty

Definition at line 452 of file tpl_dynDlist.H.

References ah_underflow_error_if, Aleph::Dlink::is_empty(), and Aleph::DynDlist< T >::remove_last_ne().

Referenced by demo_dynlist(), Aleph::HalfPlaneIntersection::operator()(), TEST(), TEST(), and Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::trace_alternating_paths().

◆ remove_last_ne()

template<typename T = int>
T Aleph::DynDlist< T >::remove_last_ne ( )
inlinenoexcept

Remove the last item of the list, which must not be empty.

The item moves out before its node leaves, so that if its move throws the list keeps it.

Returns
the removed item

Definition at line 431 of file tpl_dynDlist.H.

Referenced by Aleph::DynDlist< T >::remove_last(), TEST(), TEST(), and TEST().

◆ rev() [1/2]

template<typename T = int>
DynDlist< T > Aleph::DynDlist< T >::rev ( ) const
inline

Definition at line 1008 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::reverse().

◆ rev() [2/2]

template<typename T = int>
DynDlist & Aleph::DynDlist< T >::rev ( )
inlinenoexcept

Definition at line 991 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::reverse().

Referenced by TEST_F().

◆ reverse() [1/2]

template<typename T = int>
DynDlist< T > Aleph::DynDlist< T >::reverse ( ) const
inline

Return a reversed copy of this

Note
Not confuse with reverse without const, which is mutable

Definition at line 1000 of file tpl_dynDlist.H.

References LocateFunctions< Container, Type >::get_it(), and Aleph::DynDlist< T >::insert().

◆ reverse() [2/2]

template<typename T = int>
DynDlist & Aleph::DynDlist< T >::reverse ( )
inlinenoexcept

◆ size()

template<typename T = int>
const size_t & Aleph::DynDlist< T >::size ( ) const
inlinenoexcept

Return the number of elements (constant time)

Definition at line 139 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::num_elem.

Referenced by Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::augment_matching(), Aleph::sort_utils_detail::counting_sort_impl(), Eepic_Plane::draw(), Aleph::load_digraph(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::make_blossom(), Aleph::HalfPlaneIntersection::operator()(), print_matching(), Aleph::sort_utils_detail::radix_sort_impl(), 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(), 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(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::trace_alternating_paths(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ split()

template<typename T = int>
void Aleph::DynDlist< T >::split ( DynDlist< T > &  l,
DynDlist< T > &  r 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Alias for split_list.

See split_list for parameter documentation.

Definition at line 596 of file tpl_dynDlist.H.

References l, r, and Aleph::DynDlist< T >::split_list().

Referenced by TEST().

◆ split_list()

template<typename T = int>
void Aleph::DynDlist< T >::split_list ( DynDlist< T > &  l,
DynDlist< T > &  r 
)
inline

Split the list in two.

This method takes the first n - n / 2 items of this and puts them, in the same order, in list l. The remainder items are put in list r. After operation this becomes empty. The order of items is preserved through l and r.

Parameters
[out]llist containing the first n - n / 2 items (must be empty)
[out]rlist containing the last n / 2 items (must be empty)
Exceptions
domain_errorif any of the lists is not empty

Definition at line 588 of file tpl_dynDlist.H.

References ah_domain_error_if, Aleph::HTList::is_empty(), l, r, and Aleph::DynDlist< T >::split_list_ne().

Referenced by Aleph::DynDlist< T >::split().

◆ split_list_ne()

template<typename T = int>
void Aleph::DynDlist< T >::split_list_ne ( DynDlist< T > &  l,
DynDlist< T > &  r 
)
inlinenoexcept

Split the list in two.

This method takes the first n - n / 2 items of this and puts them, in the same order, in list l. The remainder items are put in list r. After operation this becomes empty. The order of items is preserved through l and r. The sizes of l and r follow from the number of items, without counting them.

Parameters
[out]llist containing the first n - n / 2 items (must be empty)
[out]rlist containing the last n / 2 items (must be empty)

Definition at line 568 of file tpl_dynDlist.H.

References l, Aleph::DynDlist< T >::num_elem, r, and Aleph::Dlink::split_list().

Referenced by Aleph::DynDlist< T >::split_list(), and TEST().

◆ swap()

template<typename T = int>
void Aleph::DynDlist< T >::swap ( DynDlist< T > &  l)
inlinenoexcept

Swap in constant time all the items of this with all the items of l (very fast!)

Definition at line 550 of file tpl_dynDlist.H.

References l, Aleph::DynDlist< T >::num_elem, and Aleph::Dlink::swap().

Referenced by Aleph::DynDlist< T >::DynDlist(), Aleph::DynDlist< T >::DynDlist(), Aleph::DynDlist< T >::operator=(), and TEST_F().

◆ top() [1/2]

template<typename T = int>
T & Aleph::DynDlist< T >::top ( )
inline

See get_first().

Definition at line 509 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::get_first().

Referenced by TEST().

◆ top() [2/2]

template<typename T = int>
const T & Aleph::DynDlist< T >::top ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const.

Definition at line 516 of file tpl_dynDlist.H.

References Aleph::DynDlist< T >::get_first().

Member Data Documentation

◆ num_elem


The documentation for this class was generated from the following files: