Aleph-w  1.9
General library for algorithms and data structures
Aleph::DynDlist< T > Class Template Reference

#include <tpl_dynDlist.H>

+ Inheritance diagram for Aleph::DynDlist< T >:
+ Collaboration diagram for Aleph::DynDlist< T >:

Classes

class  Iterator
 

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 key_type = T
 The data type.
 
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)
 
 Special_Ctors (DynDlist, T)
 
void empty () noexcept
 Empty the list.
 
 ~DynDlist ()
 Destructor.
 
T & insert (const T &item)
 
T & insert (T &&item)
 
T & append (const T &item)
 
T & append (T &&item)
 
void insert (const DynDlist &list)
 
void insert (DynDlist &&list) noexcept
 
void append (const DynDlist &list) noexcept
 
void append (DynDlist &&list) noexcept
 
T & get_first_ne () const noexcept
 Return a modifiable reference to first item in the list.
 
T & get_last_ne () const noexcept
 Return a modifiable reference to last item in the list.
 
T & get_first () const
 Return a modifiable reference to first item in the list.
 
T & get_last () const
 Return a modifiable reference to last item in the list.
 
remove_first_ne () noexcept
 
remove_last_ne () noexcept
 
remove_first ()
 
remove_last ()
 
T & put (const T &item)
 
T & put (T &&item)
 
get ()
 
T & rear ()
 
T & front ()
 
T & push (const T &item)
 
T & push (T &&item)
 
pop ()
 
T & top () const
 
void remove (T &data) noexcept
 
void erase (T &data) noexcept
 
void swap (DynDlist &l) noexcept
 
void split_list_ne (DynDlist &l, DynDlist &r) noexcept
 
void split_list (DynDlist &l, DynDlist &r)
 
void split (DynDlist &l, DynDlist &r)
 
DynDlist< T > & operator= (const DynDlist &list)
 
 DynDlist (const DynDlist &list)
 
 DynDlist (DynDlist< T > &&list) noexcept
 
DynDlist< T > & operator= (DynDlist &&list) noexcept
 
T & operator[] (const size_t &n) const
 
DynDlistreverse () noexcept
 
DynDlistrev () noexcept
 
DynDlist< T > reverse () const
 
DynDlist< T > rev () const
 
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.
 
Dnodeswap (Dnode &p) noexcept(noexcept(std::swap(data, p.data)))
 Swap this with p
 
void swap (Dlink *link) noexcept
 
void swap (Dlink &l) noexcept
 
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
 
const T & get_key () const noexcept
 
template<typename T >
Dnode< T > * to_dnode () noexcept
 
template<typename T >
const Dnode< T > * to_dnode () const noexcept
 
template<typename T >
T & to_data () noexcept
 
template<typename T >
const T & to_data () const noexcept
 
void reset () noexcept
 
void init () noexcept
 
bool is_empty () const noexcept
 Return true if this (as header node) is empty.
 
bool is_unitarian () const noexcept
 Return true if this (as header node) has exactly one element.
 
bool is_unitarian_or_empty () const noexcept
 Return true if this (as header node) has zeor or one element.
 
void insert (Dlink *node) noexcept
 
void push (Dlink *node) noexcept
 
void append (Dlink *node) noexcept
 
void wrap_header (Dlink *l) noexcept
 
void insert_list (Dlink *head) noexcept
 
void append_list (Dlink *head) noexcept
 
void splice (Dlink *l) noexcept
 
void concat_list (Dlink *head) noexcept
 
void concat_list (Dlink &head) noexcept
 
Dlinkdel () noexcept
 Remove this from the list. this must not be a header node.
 
void erase () noexcept
 
Dlinktop ()
 
size_t reverse_list () noexcept
 
size_t split_list_ne (Dlink &l, Dlink &r) noexcept
 
size_t split_list (Dlink &l, Dlink &r) noexcept
 
Dlink cut_list (Dlink *link) noexcept
 
void remove_all_and_delete () noexcept
 
void rotate_left (size_t n)
 
void rotate_right (size_t n)
 
bool check ()
 Return true if the list is consistent.
 
bool traverse (Operation &operation) noexcept(noexcept(operation))
 
bool traverse (Operation &operation) const noexcept(noexcept(operation))
 
bool traverse (Operation &&operation) const noexcept(noexcept(operation))
 
bool traverse (Operation &&operation) noexcept(noexcept(operation))
 
auto get_it () const
 
auto get_it (size_t pos) const
 
auto get_itor () const
 
T & nth_ne (const size_t n) noexcept
 
const T & nth_ne (const size_t n) const noexcept
 
T & nth (const size_t n)
 
const T & nth (const size_t n) const
 
T * find_ptr (Operation &operation) noexcept(noexcept(operation))
 
const T * find_ptr (Operation &operation) const noexcept(noexcept(operation))
 
const T * find_ptr (Operation &&operation) const noexcept(noexcept(operation))
 
T * find_ptr (Operation &&operation) noexcept(noexcept(operation))
 
size_t find_index (Operation &operation) const noexcept(noexcept(operation))
 
size_t find_index (Operation &&operation) const noexcept(noexcept(operation))
 
std::tuple< bool, T > find_item (Operation &operation) noexcept(noexcept(operation))
 
std::tuple< bool, T > find_item (Operation &operation) const noexcept(noexcept(operation))
 
std::tuple< bool, T > find_item (Operation &&operation) noexcept(noexcept(operation))
 
std::tuple< bool, T > find_item (Operation &&operation) const noexcept(noexcept(operation))
 
void emplace (Args &&... args)
 
void emplace_end (Args &&... args)
 
void emplace_ins (Args &&... args)
 
size_t ninsert (Args ... args)
 
size_t nappend (Args ... args)
 
void for_each (Operation &operation) noexcept(noexcept(operation))
 
void for_each (Operation &operation) const noexcept(noexcept(operation))
 
void for_each (Operation &&operation) const noexcept(noexcept(operation))
 
void for_each (Operation &&operation) noexcept(noexcept(operation))
 
void each (Operation &operation) noexcept(noexcept(operation))
 
void each (Operation &operation) const noexcept(noexcept(operation))
 
void each (Operation &&operation) const noexcept(noexcept(operation))
 
void each (Operation &&operation) noexcept(noexcept(operation))
 
void each (size_t pos, size_t slice, Operation &operation) const
 
void each (size_t pos, size_t slice, Operation &&operation) const
 
void mutable_for_each (Operation &operation) noexcept(noexcept(operation))
 
void mutable_for_each (Operation &&operation) noexcept(noexcept(operation))
 
bool all (Operation &operation) const noexcept(noexcept(operation))
 
bool all (Operation &&operation) const noexcept(noexcept(operation))
 
bool exists (Operation &op) const noexcept(noexcept(op))
 
bool exists (Operation &&op) const noexcept(noexcept(op))
 
DynList< __T > maps (Operation &op) const
 
DynList< __T > maps (Operation &&op) const
 
DynList< __T > maps_if (Prop prop, Operation &op) const
 
DynList< __T > maps_if (Prop prop, Operation &&op) const
 
DynList< T > to_dynlist () const
 
__T foldl (const __T &init, Op &op) const noexcept(noexcept(op))
 
__T foldl (const __T &init, Op &&op=Op()) const noexcept(noexcept(op))
 
fold (const T &init, Operation &operation) const noexcept(noexcept(operation))
 
fold (const T &init, Operation &&operation) const noexcept(noexcept(operation))
 
DynList< T > filter (Operation &operation) const
 
DynList< T > filter (Operation &&operation) const
 
DynList< const T *> ptr_filter (Operation &operation) const
 
DynList< const T *> ptr_filter (Operation &&operation) const
 
DynList< std::tuple< T, size_t > > pfilter (Operation &operation) const
 
DynList< std::tuple< T, size_t > > pfilter (Operation &&operation) const
 
std::pair< DynList< T >, DynList< T > > partition (Operation &op) const
 
std::pair< DynList< T >, DynList< T > > partition (Operation &&op) const
 
std::pair< DynList< T >, DynList< T > > partition (size_t n) const
 
std::tuple< DynList< T >, DynList< T > > tpartition (Operation &op) const
 
std::tuple< DynList< T >, DynList< T > > tpartition (Operation &&op) const
 
size_t length () const noexcept
 
DynList< T > take (const size_t n) const
 
DynList< T > take (size_t i, size_t j, size_t step=1) const
 
DynList< T > drop (const size_t n) const
 
void mutable_drop (size_t n)
 
DynList< T > items () const
 
DynList< T > keys () const
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cbegin () noexcept
 
const_iterator cend () const noexcept
 
const_iterator cend () noexcept
 

Static Public Member Functions

static Dnodedata_to_node (T &data) noexcept
 

Protected Attributes

Dlinkprev
 
Dlinknext
 

Detailed Description

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

Dynamic list of items of generic items of type T based on double linked lists.

See also
DynDlist::Iterator

Constructor & Destructor Documentation

◆ DynDlist() [1/2]

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

◆ DynDlist() [2/2]

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

Move constructor; all items of list are moved.

The construction time is constant, independently of number of items of list

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

Member Function Documentation

◆ all() [1/2]

bool Aleph::FunctionalMethods< DynDlist< T > , T >::all ( Operation &  operation) const
inlinenoexceptinherited

Check if all the elements of container satisfy a condition.

all(operation) checks if for each element item of container operation(item) returns true.

This method has complexity $O(n)$ in average and worst case.

Parameters
[in]operationto be used as condition
Returns
true if all the elements satisfy the criteria: false otherwise.
Exceptions
anythingthat could throw operation

◆ all() [2/2]

bool Aleph::FunctionalMethods< DynDlist< T > , T >::all ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ append() [1/5]

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_allocsi no hay memoria para el nuevo elemento.
+ Here is the caller graph for this function:

◆ append() [2/5]

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_allocsi no hay memoria para el nuevo elemento.

◆ append() [3/5]

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

Append all the elements of list after this.

Parameters
[in]listto insert after this

◆ append() [4/5]

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

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

◆ append() [5/5]

void Aleph::Dlink::append ( Dlink node)
inlinenoexceptinherited

Insert nodebefore this.

Parameters
[in]nodepointer to an empty node (it must no be inserted in another list)
+ Here is the caller graph for this function:

◆ append_list()

void Aleph::Dlink::append_list ( Dlink head)
inlinenoexceptinherited

Insert the list head after this

This method assumes that this is a node part of list; it is not the header node. On the other hand, head is the header node of an entire list. So, all the list head is entirely appended, in constant time, after the node this. After append, the list head becomes empty.

Parameters
[in]headheader for the list to insert
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ concat_list() [1/2]

void Aleph::Dlink::concat_list ( Dlink head)
inlinenoexceptinherited

Concatenate list head to list this

this and head are both header nodes of lists. concat_list(head) concatenates in constant time all the list head after this. After the concatenation head becomes empty.

Parameters
headheader node of list to concatenate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ concat_list() [2/2]

void Aleph::Dlink::concat_list ( Dlink head)
inlinenoexceptinherited

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

+ Here is the call graph for this function:

◆ cut_list()

Dlink Aleph::Dlink::cut_list ( Dlink link)
inlinenoexceptinherited

Cut this from link.

cut_list(link) takes a valid link to an item of the list and on that link performs a cut; that is, all the items from link passes to a new list whose head is the return value.

The operation takes constant time.

Warning
Takes in account that the return value is Dlink object, not a pointer.
if link belongs to a list, then this one will be in an inconsistent state.
Parameters
[in]linkpointer to the item from which the cut will be done
Returns
a Dlink header of a new list containing the items from link
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ data_to_node()

template<typename T>
static Dnode* Aleph::Dnode< T >::data_to_node ( T &  data)
inlinestaticnoexceptinherited

Given an reference to the data in the node, returns a pointer to the Dnode object that contains it.

+ Here is the caller graph for this function:

◆ drop()

DynList<T> Aleph::FunctionalMethods< DynDlist< T > , T >::drop ( const size_t  n) const
inlineinherited

Drop the first n elements seen in the container during its traversal.

The complexity of this method is $O(N)$ where N always is the number of elements of container.

Returns
A DynList<T> having the remainder $N - n$ elements according to traversal order.
Exceptions
bad_allocif there is no enough memory or out_of_range if n is greater or equal than N (the number of elements in the container).

◆ each() [1/6]

void Aleph::FunctionalMethods< DynDlist< T > , T >::each ( Operation &  operation)
inlinenoexceptinherited

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

◆ each() [2/6]

void Aleph::FunctionalMethods< DynDlist< T > , T >::each ( Operation &  operation) const
inlinenoexceptinherited

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

◆ each() [3/6]

void Aleph::FunctionalMethods< DynDlist< T > , T >::each ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ each() [4/6]

void Aleph::FunctionalMethods< DynDlist< T > , T >::each ( Operation &&  operation)
inlinenoexceptinherited

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

◆ each() [5/6]

void Aleph::FunctionalMethods< DynDlist< T > , T >::each ( size_t  pos,
size_t  slice,
Operation &  operation 
) const
inlineinherited

Traverse all the container and performs a mutable operation on each element.

mutable_for_each(operation) traverses the container and on each element item is performed operation(item).

operation could have the following signature:

void operation(T & item)

Be very careful with the fact that this method allows to modify the elements themselves, what could badly alter the internal state of container. This would be the case for heaps, binary trees and hash tables.

Parameters
[in]<tt>operation</tt>to be done on each element.
Returns
an reference to this
Exceptions
anythingthat can throw operation

◆ each() [6/6]

void Aleph::FunctionalMethods< DynDlist< T > , T >::each ( size_t  pos,
size_t  slice,
Operation &&  operation 
) const
inlineinherited

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

◆ emplace()

void Aleph::FunctionalMethods< DynDlist< T > , T >::emplace ( Args &&...  args)
inlineinherited

Appends a new element into the container by constructing it in-place with the given args.

emplace(args) tries to match a constructor T(args). If this exists, then this is constructed in-place and directly forwarded to the method append() of container. If all on the container and T` is adequately done, then the object is constructed once time, successively forwarded and at its target place in the container is moved, avoiding thus unnecessary copies.

Note
The semantic of append depends of container. In general, this has some sense for lists and arrays and it means insertion at the end of sequence. On other type of container append() is equivalent to insert().
Parameters
[in]argsvariadic arguments list
Exceptions
bad_allocif there is no enough memory

◆ emplace_end()

void Aleph::FunctionalMethods< DynDlist< T > , T >::emplace_end ( Args &&...  args)
inlineinherited

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

◆ emplace_ins()

void Aleph::FunctionalMethods< DynDlist< T > , T >::emplace_ins ( Args &&...  args)
inlineinherited

Insert a new element into the container by constructing it in-place with the given args.

emplace_ins(args) tries to match a constructor T(args). If this exists, then this is constructed in-place and directly forwarded to the method insert() of container. If all on the container and T` is adequately done, then the object is constructed once time, successively forwarded and finally, at its target place in the container, is moved, avoiding thus unnecessary copies.

Note
The semantic of insert() depends of container. In general, this has some sense for lists and arrays and it means insertion at the beginning of sequence. On other type of container append() is equivalent to insert().
Parameters
[in]argsvariadic arguments list
Exceptions
bad_allocif there is no enough memory

◆ erase() [1/2]

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

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

◆ erase() [2/2]

void Aleph::Dlink::erase ( )
inlinenoexceptinherited

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

+ Here is the call graph for this function:

◆ exists() [1/2]

bool Aleph::FunctionalMethods< DynDlist< T > , T >::exists ( Operation &  op) const
inlinenoexceptinherited

Test for existence in the container of an element satisfying a criteria.

exists(op) returns true if it exists any element item in container for which op(item) return true.

This method has complexity $O(n)$ in average and worst case.

Parameters
[in]opoperation for testing existence
Returns
true if it exists an item for which op return true; false otherwise.
Exceptions
anythingthat could throw op

◆ exists() [2/2]

bool Aleph::FunctionalMethods< DynDlist< T > , T >::exists ( Operation &&  op) const
inlinenoexceptinherited

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

◆ filter() [1/2]

DynList<T> Aleph::FunctionalMethods< DynDlist< T > , T >::filter ( Operation &  operation) const
inlineinherited

Filter the elements of a container according to a matching criteria.

This method builds a dynamic list with copies of items of container matching a criteria defined by operation, which should have the following signature:

bool operation(const T & item)

If operation return true then item matches the criteria; otherwise, operation must return false.

For example, if the container has integer, the the following code snippet would return a list containing the items greater than 100:

c.filter([] (auto item) { return item > 100; });
Parameters
[in]operationdefining the flter criteria
Returns
a DynList<T> with the matched elements.
Exceptions
anythingthat could throw operation or bad_alloc if there is no enough memory

◆ filter() [2/2]

DynList<T> Aleph::FunctionalMethods< DynDlist< T > , T >::filter ( Operation &&  operation) const
inlineinherited

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

◆ find_index() [1/2]

size_t Aleph::LocateFunctions< DynDlist< T > , T >::find_index ( Operation &  operation) const
inlinenoexceptinherited

Find the position of an item in the container according to a searching criteria.

find_index(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and the position of the current item (which mathes operation) is returned.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)
Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in this situation, the consider your design and use a faster approach.
Parameters
[in]<tt>operation</tt>to be performed on each item for matching a searching criteria.
Returns
the last seen position. If the item is not found, then the number of items is returned.

◆ find_index() [2/2]

size_t Aleph::LocateFunctions< DynDlist< T > , T >::find_index ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ find_item() [1/4]

std::tuple<bool, T > Aleph::LocateFunctions< DynDlist< T > , T >::find_item ( Operation &  operation)
inlinenoexceptinherited

Safe sequential searching of an item matching a criteria.

find_item(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and duple containg a copy of found item is returned.

The method is said safe because returns a copy of item.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)
Parameters
[in]<tt>operation</tt>to be used as searching criteria
Returns
a duple tuple<bool, Type>. The first field indicates if the item was found and the second contains a copy of found item. If no item is found, then the first field is false and the second is the result of default constructor on the type stored in the container.

◆ find_item() [2/4]

std::tuple<bool, T > Aleph::LocateFunctions< DynDlist< T > , T >::find_item ( Operation &  operation) const
inlinenoexceptinherited

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

◆ find_item() [3/4]

std::tuple<bool, T > Aleph::LocateFunctions< DynDlist< T > , T >::find_item ( Operation &&  operation)
inlinenoexceptinherited

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

◆ find_item() [4/4]

std::tuple<bool, T > Aleph::LocateFunctions< DynDlist< T > , T >::find_item ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ find_ptr() [1/4]

T * Aleph::LocateFunctions< DynDlist< T > , T >::find_ptr ( Operation &  operation)
inlinenoexceptinherited

Find a pointer to an item in the container according to a searching criteria.

find_ptr(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and a pointer to the current item (which mathes operation) is returned.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)
Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in thie situation, the consider your design and to use an faster approach.
Parameters
[in]<tt>operation</tt>to be performed on each item for matching a searching criteria.
Returns
a valid pointer to an item if this was found or nullptr otherwise.

◆ find_ptr() [2/4]

const T * Aleph::LocateFunctions< DynDlist< T > , T >::find_ptr ( Operation &  operation) const
inlinenoexceptinherited

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

◆ find_ptr() [3/4]

const T * Aleph::LocateFunctions< DynDlist< T > , T >::find_ptr ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ find_ptr() [4/4]

T * Aleph::LocateFunctions< DynDlist< T > , T >::find_ptr ( Operation &&  operation)
inlinenoexceptinherited

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

◆ fold() [1/2]

T Aleph::FunctionalMethods< DynDlist< T > , T >::fold ( const T &  init,
Operation &  operation 
) const
inlinenoexceptinherited

Simplified version of foldl() where the folded type is the same type of elements stored in the container.

See also
foldl(const __T & init, Op & op)

◆ fold() [2/2]

T Aleph::FunctionalMethods< DynDlist< T > , T >::fold ( const T &  init,
Operation &&  operation 
) const
inlinenoexceptinherited

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

◆ foldl() [1/2]

__T Aleph::FunctionalMethods< DynDlist< T > , T >::foldl ( const __T &  init,
Op &  op 
) const
inlinenoexceptinherited

Fold the elements of the container to a specific result.

foldl(init, op) set an internal variable acc of type __T to init value. Then it traverses the container and on each item it performs:

acc = op(acc, op(acc, item);

So acc serves as a sort of accumulator.

op should have the following signature:

__T op(__T acc, const T & item);

Since foldl is overloaded with several operation structures, there is a certain flexibility with the parameter qualifiers. You could, for example, to declare acc and/or item by value.

The method is a template. The first template parameter __T specifies the final folded type. By default, this type is T (the type of elements stored in the container). The second parameter is the operation. If the folded type is the same than T (the type of item stored), the you can simply write a foldl(). For example, if the container stores integer, in order to determine the maximum of all elements you could do:

c.foldl(std::numeric_limits<int>::min(), [] (int acc, int item)
  {
    return std::min(acc, item);
  });

When the folded type is different than T, then you must specify the folded type as template parameter. For example, if you want to compute the sum of inversed elements, the you could do it as follows:

c.template foldl<double>(0, [] (double acc, int item)
  {
    return acu + 1.0/item;
  });
Parameters
[in]initinitial value of folded value (or accumulator).
[in]opoperation to be performed on each item and used for folding.
Returns
the final folded computation.
Exceptions
anythingthat could throw op

◆ foldl() [2/2]

__T Aleph::FunctionalMethods< DynDlist< T > , T >::foldl ( const __T &  init,
Op &&  op = Op() 
) const
inlinenoexceptinherited

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

◆ for_each() [1/4]

void Aleph::FunctionalMethods< DynDlist< T > , T >::for_each ( Operation &  operation)
inlinenoexceptinherited

Traverse all the container and performs an operation on each element.

for_each(operation) traverses the container and on each element item is performed operation(item).

operation must have the following signature:

void operation(const T & item)

Overloadings of this method allow that that the signature can be lightly different; for example, remove the reference or the const.

Parameters
[in]<tt>operation</tt>to be done on each element.
Returns
an reference to this
Exceptions
anythingthat can throw operation

◆ for_each() [2/4]

void Aleph::FunctionalMethods< DynDlist< T > , T >::for_each ( Operation &  operation) const
inlinenoexceptinherited

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

◆ for_each() [3/4]

void Aleph::FunctionalMethods< DynDlist< T > , T >::for_each ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ for_each() [4/4]

void Aleph::FunctionalMethods< DynDlist< T > , T >::for_each ( Operation &&  operation)
inlinenoexceptinherited

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

◆ 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

◆ get()

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

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

+ Here is the caller graph for this function:

◆ get_it() [1/2]

auto Aleph::LocateFunctions< DynDlist< T > , T >::get_it ( ) const
inlineinherited

Return an properly initialized iterator positioned at the first item on the container

◆ get_it() [2/2]

auto Aleph::LocateFunctions< DynDlist< T > , T >::get_it ( size_t  pos) const
inlineinherited

Return an properly initialized iterator positioned at the pos item on the container

◆ get_itor()

auto Aleph::LocateFunctions< DynDlist< T > , T >::get_itor ( ) const
inlineinherited

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

◆ get_key() [1/2]

template<typename T>
T& Aleph::Dnode< T >::get_key ( )
inlinenoexceptinherited

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

+ Here is the caller graph for this function:

◆ get_key() [2/2]

template<typename T>
const T& Aleph::Dnode< T >::get_key ( ) const
inlinenoexceptinherited

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

◆ init()

void Aleph::Dlink::init ( )
inlinenoexceptinherited

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert() [1/5]

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
+ Here is the caller graph for this function:

◆ insert() [2/5]

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

◆ insert() [3/5]

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.

◆ insert() [4/5]

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

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

◆ insert() [5/5]

void Aleph::Dlink::insert ( Dlink node)
inlinenoexceptinherited

Insert node after this.

Parameters
[in]nodepointer to an empty node (it must not be linked to nothing
+ Here is the caller graph for this function:

◆ insert_list()

void Aleph::Dlink::insert_list ( Dlink head)
inlinenoexceptinherited

Insert the list head before this

This method assumes that this is a node part of list; it is not the header node. On the other hand, head is the header node of an entire list. So, all the list head is entirely inserted, in constant time, before the node this. After insertion, the list head becomes empty.

Parameters
[in]headheader for the list to insert
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ items()

DynList<T> Aleph::GenericItems< DynDlist< T > , T >::items ( ) const
inlineinherited

Return a list of all the elements of a container sorted by traversal order.

Returns
a DynList<T> containing all the elements of the container
Exceptions
bad_allocif there is no enough memory

◆ keys()

DynList<T> Aleph::GenericItems< DynDlist< T > , T >::keys ( ) const
inlineinherited

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

◆ length()

size_t Aleph::FunctionalMethods< DynDlist< T > , T >::length ( ) const
inlinenoexceptinherited

Count the number of elements of a container.

This method counts the number of elements stored in the container.

Note
Take in account that this method computes; it does not retrieve. Consequently it always takes $O(n)$. However, for many containers this number is already stored and retrievable in $O(1)$ through the methos size()
Returns
the number of elements stored in the container.

◆ maps() [1/2]

DynList<__T> Aleph::FunctionalMethods< DynDlist< T > , T >::maps ( Operation &  op) const
inlineinherited

Map the elements of the container.

maps(op) produces a dynamic list resulting of mapping of each element of container item to the result of operation op(item).

maps() is a template method which receives as template parameters the type __T, which is the type of target or range of mapping, and the transforming operation. By default __T is the same type of the elements stored in the container.

operation should have the following signature:

__T operation(const T & item)

So, operation(item) performs a transformation of item towards the type __T.

If __T ==T`, which is common and by default, then you could specify a mapping without need of template specification. For example, if the container has integer values, the a mapping of item multiplied by 4 could be very simply written as follows:

c.maps([] (int item) { return 4*i; });

In contrast, if the range type is different than the domain type, then it is necessary to specify the template keyword in the method call. For example, if the range is double and you want to return the elements divided by 4, the could do as follows:

c.template maps<double>([] (int item) { return 1.0*item/4; });
Parameters
[in]opoperation to be performed in order to do the transformation on an item
Returns
a `DynList<__T> object containing the mapped items. The order of resulting list is the same than the order of visit of the iterator for the container.
Exceptions
anythingthat could throw op or bad_alloc if there is no enough memory

◆ maps() [2/2]

DynList<__T> Aleph::FunctionalMethods< DynDlist< T > , T >::maps ( Operation &&  op) const
inlineinherited

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

◆ maps_if() [1/2]

DynList<__T> Aleph::FunctionalMethods< DynDlist< T > , T >::maps_if ( Prop  prop,
Operation &  op 
) const
inlineinherited

Conditional mapping of the elements of the container.

maps_if(prop, op) traverses each item of container, on each item it tests the proposition prop. If this last is true, then the item is mapped through the function op(item).

Parameters
[in]opoperation to be perfomed in order to do the transformation on an item.
[in]propa lambda returning a bool which perform the logical test.
Returns
a `DynList<__T> object containing the mapped items. The order of resulting list is the same than the order of visit of the iterator for the container.
Exceptions
anythingthat could throw op or bad_alloc if there is no enough memory

◆ maps_if() [2/2]

DynList<__T> Aleph::FunctionalMethods< DynDlist< T > , T >::maps_if ( Prop  prop,
Operation &&  op 
) const
inlineinherited

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

◆ mutable_drop()

void Aleph::FunctionalMethods< DynDlist< T > , T >::mutable_drop ( size_t  n)
inlineinherited

Drop the first n elements seen from container.

The complexity of this method is $O(N)$ where N always is the number of elements of container.

Exceptions
out_of_rangeif n is greater or equal than N (the number of elements in the container).

◆ mutable_for_each()

void Aleph::FunctionalMethods< DynDlist< T > , T >::mutable_for_each ( Operation &&  operation)
inlinenoexceptinherited

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

◆ nappend()

size_t Aleph::FunctionalMethods< DynDlist< T > , T >::nappend ( Args ...  args)
inlineinherited

Append n variadic items

Parameters
[in]argsitems to be appended
Returns
the number of appended items

◆ ninsert()

size_t Aleph::FunctionalMethods< DynDlist< T > , T >::ninsert ( Args ...  args)
inlineinherited

Insert n variadic items

Parameters
[in]argsitems to be inserted
Returns
the number of inserted items

◆ nth() [1/2]

T & Aleph::LocateFunctions< DynDlist< T > , T >::nth ( const size_t  n)
inlineinherited

Return the n-th item of container.

The notion of ordinal depends of type of container. On list, probably will be the insertion order. On binary search trees will be the nth smaller item. On hash tables will be pseudo random.

Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in this situation, then consider your design and to use an faster approach.
Parameters
[in]nthe nth item to find
Returns
a valid reference to the item into the container.
Exceptions
out_of_rangeif n is greater or equal that the size of container.

◆ nth() [2/2]

const T & Aleph::LocateFunctions< DynDlist< T > , T >::nth ( const size_t  n) const
inlineinherited

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

◆ nth_ne()

const T & Aleph::LocateFunctions< DynDlist< T > , T >::nth_ne ( const size_t  n) const
inlinenoexceptinherited

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

◆ 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

◆ 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

◆ operator[]()

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

Return a modifiable reference to the i-th item of the list. Throw overflow_error if n is greater than the list size

◆ partition() [1/3]

std::pair<DynList<T>, DynList<T> > Aleph::FunctionalMethods< DynDlist< T > , T >::partition ( Operation &  op) const
inlineinherited

Exclusive partition of container according to a filter criteria.

partition(op) traverses the container and filters its elements according to the filter criteria defined by op. The filtered elements are copied to a first list and the not filtered ones to a second list. When all the container is traversed, a pair containing these lists is returned.

The op requirements are the same than for filter().

Parameters
[in]opoperation instrumenting the filter criteria
Returns
a std::pair<DynList<T>, DynList<T>>.firstcontains the filtered elements andsecondthe non-filtered ones. \throw anything that could throw op orbad_alloc` if there is no enough memory
See also
filter()

◆ partition() [2/3]

std::pair<DynList<T>, DynList<T> > Aleph::FunctionalMethods< DynDlist< T > , T >::partition ( Operation &&  op) const
inlineinherited

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

◆ partition() [3/3]

std::pair<DynList<T>, DynList<T> > Aleph::FunctionalMethods< DynDlist< T > , T >::partition ( size_t  n) const
inlineinherited

Exclusive partition of container in the nth item

partition(n) traverses the container and produces a pair of lists. The first one contains the first n elements and the second one the this->size() - n remaining elements.

Parameters
[in]nthe first n items of the first list
Exceptions
anythingthat could throw op or bad_alloc if there is no enough memory

◆ pfilter() [1/2]

DynList<std::tuple<T, size_t> > Aleph::FunctionalMethods< DynDlist< T > , T >::pfilter ( Operation &  operation) const
inlineinherited

Filter the elements of a container according to a matching criteria and determine its positions respect to the traversal of container.

pfilter(operation) is very similar to filter(), but instead of building a list of filtered elements, it builds a list of pairs with form (item, pos), where item is a copy of filtered element and pos is its position respect to the traversal order. The position is relative to the container type.

The pair is defined with a tuple:

std::tuple<T, size_t>
Parameters
[in]operationthat defines the filter criteria
Returns
a DynList
Exceptions
bad_allocif there is no enough memory
See also
filter(Operation & operation)

◆ pfilter() [2/2]

DynList<std::tuple<T, size_t> > Aleph::FunctionalMethods< DynDlist< T > , T >::pfilter ( Operation &&  operation) const
inlineinherited

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

◆ pop()

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

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

◆ ptr_filter()

DynList<const T*> Aleph::FunctionalMethods< DynDlist< T > , T >::ptr_filter ( Operation &  operation) const
inlineinherited

Filter the elements of a container according to a matching criteria an return pointer to the matched items in the container.

This method builds a dynamic list with stores pointers to the items of matching a criteria defined by operation, which should have the followgin signature:

bool operation(const T & item)

If operation return true then item matches the criteria; otherwise, operation must return false.

For example, if the container has integer, the the following code snippet would return a list containing the items greater than 100:

c.ptr_filter([] (auto item) { return item > 100; });
Parameters
[in]operationdefining the flter criteria
Returns
a DynList<const T*> with the pointers to the matched elements.
Exceptions
anythingthat could throw operation or bad_alloc if there is no enough memory

◆ push() [1/3]

void Aleph::Dlink::push ( Dlink node)
inlinenoexceptinherited

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

+ Here is the call graph for this function:

◆ push() [2/3]

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

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

◆ push() [3/3]

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

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

◆ put() [1/2]

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

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

+ Here is the caller graph for this function:

◆ put() [2/2]

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

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

◆ 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

◆ 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 of accessor methods of this class.
Parameters
[in]datavalid reference to the item in the list.

◆ remove_all_and_delete()

void Aleph::Dlink::remove_all_and_delete ( )
inlinenoexceptinherited

Remove and free memory for all the items of list.

remove_all_and_delete() remove each item of the list and call to delete operator on the removed item. At the end of call, all the items were removed, all the memory freed qand the list emptied.

Warning
This method only has sense if the items of list were dynamically allocated with new. Although That is very frequently the case, there are some exceptions. So, be sure that the items were allocated with new operator.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_first()

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

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

Returns
a copy of removed item
Exceptions
underflow_errorif this is empty
+ Here is the caller graph for this function:

◆ remove_first_ne()

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

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

Returns
a copy of removed item
+ Here is the caller graph for this function:

◆ 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
+ Here is the caller graph for this function:

◆ remove_last_ne()

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

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

Returns
a copy of removed item
+ Here is the caller graph for this function:

◆ reset()

void Aleph::Dlink::reset ( )
inlinenoexceptinherited

Reset this

reset() reinitialize the node to point to itself. So, all the context is lost. Use with care.

+ Here is the caller graph for this function:

◆ reverse()

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

◆ reverse_list()

size_t Aleph::Dlink::reverse_list ( )
inlinenoexceptinherited

Reverse the list.

Returns
the number of items that has the list
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rotate_left()

void Aleph::Dlink::rotate_left ( size_t  n)
inlineinherited

Rotate to left the list n positions.

rotate_left(n) rotates the items to left n positions. For example, if the list is as follows:

l0, l1, l2, l3, l4, l5, l6, l7, l8, l9

Then rotate_left(4) produces the following state:

l4, l5, l6, l7, l8, l9, l0, l1, l2, l3
Parameters
[in]nthe number of position to be rotated
Exceptions
domain_errorif list is empty
+ Here is the call graph for this function:

◆ rotate_right()

void Aleph::Dlink::rotate_right ( size_t  n)
inlineinherited

Analogous to rotate_left() but to right

+ Here is the call graph for this function:

◆ Special_Ctors()

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

Construct a new list with copies of elements of list l

Parameters
[in]llist to be copied
Exceptions
bad_allocif there is no enough memory
+ Here is the caller graph for this function:

◆ splice()

void Aleph::Dlink::splice ( Dlink l)
inlinenoexceptinherited

Insert a list l without header node after the node this.

Parameters
[in]llist without header node to be inserted after this
+ Here is the call graph for this function:

◆ 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.

◆ 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/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 containg the first n/2 first items
[out]llist containg the last n/2 first items
Exceptions
domain_errorany of the lists is noty empty
+ Here is the caller graph for this function:

◆ split_list_ne() [1/2]

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/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 containg the first n/2 first items
[out]llist containg the last n/2 first items
Exceptions
domain_errorany of the lists is noty empty
+ Here is the caller graph for this function:

◆ split_list_ne() [2/2]

size_t Aleph::Dlink::split_list_ne ( Dlink l,
Dlink r 
)
inlinenoexceptinherited

Split this in the middle in two lists.

split_list(l, r) searches the middle of this an on this point cuts the list in two lists l and r respectively. After the operation, this becomes empty.

Note
l
Parameters
[out]lfirst n/2 items of this
[out]rlast n/2 items of this
Returns
total number of nodes of both list (what is the same number of node that had this before the split
+ Here is the call graph for this function:

◆ swap() [1/3]

void Aleph::Dlink::swap ( Dlink link)
inlinenoexceptinherited

Swap this with list whose header is link.

swap(link) swaps the content og this with all the content of the list pointed by link. The operation is performed in constant time independently of sizes of both lists.

Parameters
[in]linkpointer to the list to be swapped
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ swap() [2/3]

void Aleph::Dlink::swap ( Dlink l)
inlinenoexceptinherited

Swap this with list whose header is l.

swap(l) swaps the content og this with all the content of the list referenced by l. The operation is performed in constant time independently of sizes of both lists.

Parameters
[in]llist to be swapped with this
+ Here is the call graph for this function:

◆ swap() [3/3]

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!)

+ Here is the caller graph for this function:

◆ take() [1/2]

DynList<T> Aleph::FunctionalMethods< DynDlist< T > , T >::take ( const size_t  n) const
inlineinherited

Return a list with the first n elements seen in the container during its traversal.

The complexity of this method is $O(n)$ where n can be less than the number of elements of container.

Returns
A DynList<T> having the first n elements according to its traversal order.
Exceptions
bad_allocif there is no enough memory or out_of_range if n is greater or equal than the number of elements in the container.

◆ take() [2/2]

DynList<T> Aleph::FunctionalMethods< DynDlist< T > , T >::take ( size_t  i,
size_t  j,
size_t  step = 1 
) const
inlineinherited

Return a list with elements seen in the container between i and j position respect to its traversal.

The complexity of this method is $O(n)$ where n can be less than the number of elements of container.

Returns
A DynList<T> having the first n elements according to its traversal order.
Exceptions
bad_allocif there is no enough memory or out_of_range if n is greater or equal than the number of elements in the container.

◆ top() [1/2]

template<typename T = int>
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.

◆ top() [2/2]

Dlink* Aleph::Dlink::top ( )
inlineinherited

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

+ Here is the call graph for this function:

◆ tpartition() [1/2]

std::tuple<DynList<T>, DynList<T> > Aleph::FunctionalMethods< DynDlist< T > , T >::tpartition ( Operation &  op) const
inlineinherited

Exclusive partition of container according to a filter criteria.

This methos has exactly the same semantic than partition(Operation & op), excepts than instead of returning a std::pair it returns a std::tuple.

Parameters
[in]opoperation instrumenting the filter criteria
Returns
a std::tuple<DynList<T>, DynList<T>>.firstcontains the filteres elements andsecondthe non-filtered ones. \throw anything that could throw op orbad_alloc` if there is no enough memory
See also
partition(Operation & op)

◆ tpartition() [2/2]

std::tuple<DynList<T>, DynList<T> > Aleph::FunctionalMethods< DynDlist< T > , T >::tpartition ( Operation &&  op) const
inlineinherited

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

◆ traverse() [1/4]

bool Aleph::GenericTraverse< DynDlist< T > >::traverse ( Operation &  operation)
inlinenoexceptinherited

Traverse the container via its iterator and performs a conditioned operation on each item.

traverse(operation) instantiates the internal iterator of the class and traverses each item performing operation(item).

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)

If operation(item) returns true then the iterator is advanced and the next item processed. Otherwise. the traversal stops.

Parameters
[in]operationto be performed on each item
Returns
true if all the items were visited (operation on each one always returned true) or false if the traversal was stoppep because there was a false result on an item.
Exceptions
anythingthat could throw operation

◆ traverse() [2/4]

bool Aleph::GenericTraverse< DynDlist< T > >::traverse ( Operation &  operation) const
inlinenoexceptinherited

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

◆ traverse() [3/4]

bool Aleph::GenericTraverse< DynDlist< T > >::traverse ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ traverse() [4/4]

bool Aleph::GenericTraverse< DynDlist< T > >::traverse ( Operation &&  operation)
inlinenoexceptinherited

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

◆ wrap_header()

void Aleph::Dlink::wrap_header ( Dlink l)
inlinenoexceptinherited

Wrap a header to a list (without header).

Sometimes, especially for low level applications, you coult manage linked list without header nodes. In this case, in order to profit some operations expeting a list with header, you could "wrap" a temporal header and use the list and the operations of this class.

For example, suppose we have a list l without header node and we wish to insert it into a another list with a header node. In this case, we wrap a header to l as follows:

Dlink h;
h.wrap_header(l);

Now, if we have a node p of another list, we could insert l after p as follows:

p->insert_list(&h);

After this operation h becomes empty and the list l is inserted after the node p

Parameters
[in]lfirst node of a double and circular list without header node
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

Leandro Rabindranath León