Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
FunctionalMethods< Container, T > Class Template Reference

Common methods to the Aleph-w ( \(\aleph_\omega\)) containers. More...

#include <ah-dry.H>

Inherited by Aleph::Array< size_t >, Aleph::Array< std::string >, Aleph::Array< int >, Aleph::Array< Aleph::Array< std::string > >, Aleph::Array< string >, Aleph::ArrayQueue< int >, Aleph::ArrayQueue< Aleph::DynList< int > >, Aleph::ArrayStack< Node * >, Aleph::ArrayStack< int >, Aleph::ArrayStack< Aleph::DynList< int > >, Aleph::DynArray< GT_Node * >, Aleph::DynArray< Point >, Aleph::DynArray< Node * >, Aleph::DynArray< Entry_Type >, Aleph::DynArray< typename GT::Arc * >, Aleph::DynArray< Aleph::Byte >, Aleph::DynArray< typename GT::Node * >, Aleph::DynArray< long >, Aleph::DynArray< Distance_Type >, Aleph::DynArray< Dnode< Key > >, Aleph::DynArray< Aleph::Map_Matrix_Graph::Mat_Entry >, Aleph::DynArray< Node_Type >, Aleph::DynArray< Arc_Type >, Aleph::DynArray< Aleph::Simplex_Node_Info >, Aleph::DynArray< Aleph::Simplex_Arc_Info >, Aleph::DynArray< string >, Aleph::DynArray< int >, Aleph::DynArray< Event_Handler >, Aleph::DynArray< size_t >, Aleph::DynArray< void * >, Aleph::DynArray< Aleph::DynArray< Node * > >, Aleph::DynArray< double >, Aleph::DynDlist< typename GT::Node * >, Aleph::DynDlist< Aleph::Path::Path_Desc >, Aleph::DynDlist< T * >, Aleph::DynDlist< ConstraintType >, Aleph::DynDlist< int >, Aleph::DynDlist< Tag_Data >, Aleph::DynDlist< Arc_Desc >, Aleph::DynDlist< Thread_Desc >, Aleph::DynDlist< Eepic_Geom_Object * >, Aleph::DynDlist< Polinomio::Termino >, Aleph::DynDlist< Arc_Data >, Aleph::DynDlist< Connexion_Data >, Aleph::DynHashTable< std::pair< Key, Data >, LhashTable, Dft_Pair_Cmp< Key, Data, Aleph::equal_to< Key > > >, Aleph::DynHashTable< Key, LhashTable, Aleph::equal_to< Key > >, Aleph::DynHashTable< Key, LinearHashTable, Aleph::equal_to< Key > >, Aleph::DynList< int >, Aleph::DynList< std::pair< size_t, size_t > >, Aleph::DynList< typename GT::Arc * >, Aleph::DynList< Arc * >, Aleph::DynList< Node * >, Aleph::DynList< Aleph::FlowPath< Aleph::Net_Graph > >, Aleph::DynList< Aleph::FlowCycle< Aleph::Net_Graph > >, Aleph::DynList< void * >, Aleph::DynList< typename GT::Node * >, Aleph::DynList< Aleph::Tree_Node * >, Aleph::DynList< Aleph::DynList< int > >, Aleph::DynList< size_t >, Aleph::DynList< Point >, Aleph::DynList< QueueTheadsPool::ConsumerQueueEvent * >, Aleph::DynList< char >, Aleph::DynList< string >, Aleph::DynList< std::string >, Aleph::DynList< std::thread >, Aleph::DynListQueue< Aleph::DynList< int > >, Aleph::DynListQueue< int >, Aleph::DynListStack< typename GT::Node * >, Aleph::DynListStack< Aleph::Tree_Node * >, Aleph::DynListStack< Aleph::DynList< int > >, Aleph::DynListStack< int >, Aleph::DynListStack< string >, Aleph::DynMatrix< long >, Aleph::DynMatrix< Distance_Type >, Aleph::DynMatrix< int >, Aleph::DynMatrix< double >, Aleph::DynSetTree< GT::Arc *, Treap, Dft_Arc_Cmp< GT > >, Aleph::DynSetTree< std::pair< Key, Type >, Avl_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, BinTree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Rand_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Rb_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Splay_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Treap, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Treap_Rk, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Data >, Avl_Tree, Dft_Pair_Cmp< Key, Data, Aleph::less< Key > > >, Aleph::DynSetTree< Key, Avl_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Avl_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, BinTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, HtdRbTreeRk, Aleph::less< Key > >, Aleph::DynSetTree< Key, HtdRbTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rand_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rb_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rb_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Splay_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Splay_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, TdRbTreeRk, Aleph::less< Key > >, Aleph::DynSetTree< Key, TdRbTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Treap, Aleph::less< Key > >, Aleph::DynSetTree< Key, Treap_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Node * >, Aleph::DynSetTree< GT::Node *, Treap, Dft_Node_Cmp< GT > >, Aleph::DynSetTree< GT_Arc *, Rand_Tree, Aleph::IndexArc::Cmp_Arc >, Aleph::DynSetTree< std::pair< Key, Operation >, Avl_Tree, Dft_Pair_Cmp< Key, Operation, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, ValueType >, Avl_Tree, Dft_Pair_Cmp< Key, ValueType, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< void *, Flow_Type >, Avl_Tree, Dft_Pair_Cmp< void *, Flow_Type, Aleph::less< void * > > >, Aleph::DynSetTree< std::pair< Node *, Node * >, Treap, Dft_Pair_Cmp< Node *, Node *, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< std::string, Huffman_Node * >, Treap_Vtl, Dft_Pair_Cmp< std::string, Huffman_Node *, Aleph::less< std::string > > >, Aleph::DynSetTree< std::pair< std::string, BitArray >, Treap_Vtl, Dft_Pair_Cmp< std::string, BitArray, Aleph::less< std::string > > >, Aleph::DynSetTree< GT_Node *, Treap, Dft_Node_Cmp< GT > >, Aleph::DynSetTree< GT_Arc *, Treap, Aleph::IndexArc::Cmp_Arc >, Aleph::DynSetTree< std::pair< int, int >, Avl_Tree, Aleph::less< std::pair< int, int > > >, Aleph::DynSetTree< std::pair< Node *, Node * >, Avl_Tree, Dft_Pair_Cmp< Node *, Node *, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Arc *, Arc * >, Avl_Tree, Dft_Pair_Cmp< Arc *, Arc *, Aleph::less< Arc * > > >, Aleph::DynSetTree< std::pair< Node *, Distance_Type >, Avl_Tree, Dft_Pair_Cmp< Node *, Distance_Type, Aleph::less< Node * > > >, Aleph::DynSetTree< Node *, Rand_Tree >, Aleph::DynSetTree< Arc *, Rand_Tree >, Aleph::DynSetTree< std::pair< Node *, size_t >, Avl_Tree, Dft_Pair_Cmp< Node *, size_t, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Arc *, size_t >, Avl_Tree, Dft_Pair_Cmp< Arc *, size_t, Aleph::less< Arc * > > >, Aleph::DynSetTree< GT_Node *, Rand_Tree, Aleph::less< GT_Node * > >, Aleph::DynSetTree< int >, Aleph::DynSetTree< GT_Node *, Treap, TestNodeCmp >, Aleph::DynSetTree< Relation_T::Pair, Avl_Tree, Relation_T::Cmp >, Aleph::DynSetTree< std::pair< Event::EventId, TimeoutQueue::Event * >, Avl_Tree, Dft_Pair_Cmp< Event::EventId, TimeoutQueue::Event *, Aleph::less< Event::EventId > > >, Aleph::DynSetTree< TimeoutQueue::Event * >, Aleph::DynSetTree< size_t >, Aleph::DynSkipList< int >, Aleph::FixedQueue< Aleph::DynList< int > >, Aleph::FixedQueue< int >, Aleph::FixedQueue< void * >, Aleph::FixedStack< Node * >, Aleph::FixedStack< Aleph::RbNodeRk * >, Aleph::FixedStack< RbNode * >, Aleph::FixedStack< Aleph::DynList< int > >, Aleph::FixedStack< int >, Aleph::ODhashTable< P, AhHashDispatcher::Equal >, Aleph::ODhashTable< int >, Aleph::OLhashTable< int >, Aleph::Random_Set< int >, Aleph::ArrayHeap< T, Compare >, Aleph::DynArrayHeap< T, Compare >, Aleph::DynBinHeap< T, Compare >, Aleph::DynDlist< T >, Aleph::DynHashTable< Key, HashTable, Cmp >, Aleph::DynList< T >, Aleph::DynSetTree< Key, Tree, Compare >, Aleph::DynSkipList< Key, Compare >, Aleph::ODhashTable< Key, Cmp >, and Aleph::OLhashTable< Key, Cmp >.

Public Member Functions

template<typename ... Args>
void emplace (Args &&... args)
 Appends a new element into the container by constructing it in-place with the given args.
 
template<typename ... Args>
void emplace_end (Args &&... args)
 
template<typename ... Args>
void emplace_ins (Args &&... args)
 Insert a new element into the container by constructing it in-place with the given args.
 
template<typename ... Args>
size_t ninsert (Args ... args)
 Insert n variadic items.
 
template<typename ... Args>
size_t nappend (Args ... args)
 Append n variadic items.
 
template<class Operation >
void for_each (Operation &operation)
 Traverse all the container and performs an operation on each element.
 
template<class Operation >
void for_each (Operation &operation) const
 Const overload of for_each(Operation&).
 
template<class Operation >
void for_each (Operation &&operation) const
 Overload of for_each(Operation&) const that accepts rvalues.
 
template<class Operation >
void for_each (Operation &&operation)
 Overload of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (Operation &operation)
 Alias of for_each(Operation&).
 
template<class Operation >
void each (Operation &operation) const
 Const alias of for_each(Operation&).
 
template<class Operation >
void each (Operation &&operation) const
 Const alias of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (Operation &&operation)
 Alias of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (size_t pos, const size_t slice, Operation &operation) const
 Traverse the container starting at pos taking one item every slice, performing a mutable operation on each visited element.
 
template<class Operation >
void each (const size_t pos, const size_t slice, Operation &&operation) const
 
template<class Operation >
void mutable_for_each (Operation &operation)
 
template<class Operation >
void mutable_for_each (Operation &&operation)
 
template<class Operation >
bool all (Operation &operation) const
 Check if all the elements of container satisfy a condition.
 
template<class Operation >
bool all (Operation &&operation) const
 Overload of all(Operation&) that accepts rvalues.
 
template<class Operation >
bool exists (Operation &op) const
 Test for existence in the container of an element satisfying a criteria.
 
template<class Operation >
bool exists (Operation &&op) const
 Overload of exists(Operation&) that accepts rvalues.
 
template<typename __T = T, class Operation = Aleph::Dft_Map_Op<T, __T>>
Aleph::DynList< __T > maps (Operation &op) const
 Map the elements of the container.
 
template<typename __T = T, class Operation = Aleph::Dft_Map_Op<__T, __T>>
Aleph::DynList< __T > maps (Operation &&op) const
 Overload of maps(Operation&) that accepts rvalues.
 
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __Tmaps_if (Prop prop, Operation &op) const
 Conditional mapping of the elements of the container.
 
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __Tmaps_if (Prop prop, Operation &&op) const
 Overload of maps_if(Prop, Operation&) that accepts rvalues.
 
Aleph::DynList< T > to_dynlist () const
 Convert container to DynList.
 
std::vector< T > to_vector () const
 Convert container to std::vector.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T foldl (const __T &init, Op &op) const
 Fold the elements of the container to a specific result.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T foldl (const __T &init, Op &&op=Op()) const
 Overload of foldl(const __T&, Op&) that accepts rvalues.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T fold_left (const __T &init, Op &op) const
 Alias for foldl with the same accumulator type.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T fold_left (const __T &init, Op &&op=Op()) const
 Overload of fold_left(const __T&, Op&) that accepts rvalues.
 
template<class Operation >
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 >
fold (const T &init, Operation &&operation) const
 Overload of fold(const T&, Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< T > filter (Operation &operation) const
 Filter the elements of a container according to a matching criteria.
 
template<class Operation >
Aleph::DynList< T > filter (Operation &&operation) const
 Overload of filter(Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< const T * > ptr_filter (Operation &operation) const
 Filter the elements of a container according to a matching criteria and return a pointer to the matched items in the container.
 
template<class Operation >
Aleph::DynList< const T * > ptr_filter (Operation &&operation) const
 Overload of ptr_filter(Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &operation) const
 Filter the elements of a container according to a matching criteria and determine its positions respect to the traversal of container.
 
template<class Operation >
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &&operation) const
 Overload of pfilter(Operation&) that accepts rvalues.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &op) const
 Exclusive partition of container according to a filter criteria.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &&op) const
 Overload of partition(Operation&) that accepts rvalues.
 
template<class Operation >
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 >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &op) const
 Exclusive partition of container according to a filter criteria.
 
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &&op) const
 Overload of tpartition(Operation&) that accepts rvalues.
 
size_t length () const noexcept
 Count the number of elements of a container.
 
Aleph::DynList< T > rev () const
 Return a list with the elements of container in reverse order respect to its traversal order.
 
Aleph::DynList< T > take (const size_t n) const
 Return a list with the first n elements seen in the container during its traversal.
 
Aleph::DynList< T > take (size_t i, const size_t j, const size_t step=1) const
 Return a list with elements seen in the container between i and j position respect to its traversal.
 
Aleph::DynList< T > drop (const size_t n) const
 Drop the first n elements seen in the container during its traversal.
 
void mutable_drop (const size_t n)
 Drop the first n elements seen from container.
 

Private Member Functions

Containerme ()
 
FunctionalMethods< Container, T > * base () const noexcept
 
const Containerconst_me () const noexcept
 
void nninsert (size_t &)
 
void nnappend (size_t &)
 
template<typename ... Args>
void nninsert (size_t &n, const T &item, Args &... args)
 
template<typename ... Args>
void nnappend (size_t &n, const T &item, Args &... args)
 

Related Symbols

(Note that these are not member symbols.)

 each
 
 each
 
 each
 

Detailed Description

template<class Container, typename T>
class FunctionalMethods< Container, T >

Common methods to the Aleph-w ( \(\aleph_\omega\)) containers.

This class contains many and practice methods that are common to any Aleph-w ( \(\aleph_\omega\)) container.

Definition at line 547 of file ah-dry.H.

Member Function Documentation

◆ all() [1/2]

template<class Container , typename T >
template<class Operation >
bool FunctionalMethods< Container, T >::all ( Operation &&  operation) const
inline

Overload of all(Operation&) that accepts rvalues.

Parameters
[in]operationcondition to test
Returns
true if all elements satisfy the condition

Definition at line 827 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ all() [2/2]

template<class Container , typename T >
template<class Operation >
bool FunctionalMethods< Container, T >::all ( Operation operation) const
inline

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

Definition at line 816 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by Aleph::Net_Graph< NodeT, ArcT >::check_network(), demo_functional(), demo_predicates(), demonstrate_functional(), demonstrate_functional_features(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TYPED_TEST_P().

◆ base()

template<class Container , typename T >
FunctionalMethods< Container, T > * FunctionalMethods< Container, T >::base ( ) const
inlineprivatenoexcept

Definition at line 551 of file ah-dry.H.

Referenced by FunctionalMethods< Container, T >::for_each().

◆ const_me()

◆ drop()

template<class Container , typename T >
Aleph::DynList< T > FunctionalMethods< Container, T >::drop ( const size_t  n) const
inline

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

Definition at line 1467 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by TEST(), TEST(), TEST_F(), and TEST_F().

◆ each() [1/6]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::each ( const size_t  pos,
const size_t  slice,
Operation &&  operation 
) const
inline

Definition at line 781 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ each() [2/6]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::each ( Operation &&  operation)
inline

Alias of for_each(Operation&) that accepts rvalues.

Definition at line 738 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ each() [3/6]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::each ( Operation &&  operation) const
inline

Const alias of for_each(Operation&) that accepts rvalues.

Definition at line 731 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ each() [4/6]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::each ( Operation operation)
inline

Alias of for_each(Operation&).

Definition at line 717 of file ah-dry.H.

References FunctionalMethods< Container, T >::for_each(), and FunctionalMethods< Container, T >::maps().

◆ each() [5/6]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::each ( Operation operation) const
inline

Const alias of for_each(Operation&).

Definition at line 724 of file ah-dry.H.

References FunctionalMethods< Container, T >::for_each(), and FunctionalMethods< Container, T >::maps().

◆ each() [6/6]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::each ( size_t  pos,
const size_t  slice,
Operation operation 
) const
inline

Traverse the container starting at pos taking one item every slice, performing a mutable operation on each visited element.

each(pos, slice, operation) traverses the container and on each visited element item performs 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]posstarting position (0-based)
[in]slicenumber of items to skip between visits
[in]operationto be done on each visited element.
Exceptions
anythingthat can throw operation

Definition at line 764 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ emplace()

template<class Container , typename T >
template<typename ... Args>
FunctionalMethods< Container, T >::emplace ( Args &&...  args)
inline

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 on 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

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

Definition at line 582 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps(), and FunctionalMethods< Container, T >::me().

Referenced by Aleph::maphash_to_stdmap(), Aleph::maptree_to_stdmap(), and TEST_F().

◆ emplace_end()

template<class Container , typename T >
template<typename ... Args>
void FunctionalMethods< Container, T >::emplace_end ( Args &&...  args)
inline

◆ emplace_ins()

template<class Container , typename T >
template<typename ... Args>
void FunctionalMethods< Container, T >::emplace_ins ( Args &&...  args)
inline

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 on 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

Definition at line 613 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps(), and FunctionalMethods< Container, T >::me().

◆ exists() [1/2]

template<class Container , typename T >
template<class Operation >
bool FunctionalMethods< Container, T >::exists ( Operation &&  op) const
inline

Overload of exists(Operation&) that accepts rvalues.

Parameters
[in]oppredicate to test
Returns
true if any element satisfies the predicate

Definition at line 858 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ exists() [2/2]

template<class Container , typename T >
template<class Operation >
bool FunctionalMethods< Container, T >::exists ( Operation op) const
inline

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

Definition at line 846 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), FunctionalMethods< Container, T >::maps(), and traverse().

Referenced by demo_functional(), demo_predicates(), demonstrate_functional(), demonstrate_functional_features(), Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::operator()(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ filter() [1/2]

template<class Container , typename T >
template<class Operation >
Aleph::DynList< T > FunctionalMethods< Container, T >::filter ( Operation &&  operation) const
inline

Overload of filter(Operation&) that accepts rvalues.

Parameters
[in]operationfilter predicate
Returns
DynList<T> with matching elements

Definition at line 1152 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ filter() [2/2]

template<class Container , typename T >
template<class Operation >
Aleph::DynList< T > FunctionalMethods< Container, T >::filter ( Operation operation) const
inline

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, then 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 filter criteria
Returns
a DynList<T> with the matched elements.
Exceptions
anythingthat could throw operation or bad_alloc if there is no enough memory

Definition at line 1135 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by demo_dynarray(), demo_functional(), demo_integration(), demo_practical_example(), demo_transformation(), demo_zip_utilities(), demonstrate_functional_features(), Aleph::intercept(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ fold() [1/2]

template<class Container , typename T >
template<class Operation >
T FunctionalMethods< Container, T >::fold ( const T &  init,
Operation &&  operation 
) const
inline

Overload of fold(const T&, Operation&) that accepts rvalues.

Parameters
[in]initinitial accumulator value
[in]operationfolding operation
Returns
folded result

Definition at line 1106 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ fold() [2/2]

template<class Container , typename T >
template<class Operation >
T FunctionalMethods< Container, T >::fold ( const T &  init,
Operation operation 
) const
inline

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)

Definition at line 1089 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ fold_left() [1/2]

template<class Container , typename T >
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T FunctionalMethods< Container, T >::fold_left ( const __T init,
Op &&  op = Op() 
) const
inline

Overload of fold_left(const __T&, Op&) that accepts rvalues.

Template Parameters
__Taccumulator type (default T)
Parameters
[in]initinitial accumulator value
[in]opfolding operation
Returns
folded result

Definition at line 1078 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ fold_left() [2/2]

template<class Container , typename T >
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T FunctionalMethods< Container, T >::fold_left ( const __T init,
Op op 
) const
inline

Alias for foldl with the same accumulator type.

Template Parameters
__Taccumulator type (default T)
Parameters
[in]initinitial accumulator value
[in]opfolding operation
Returns
folded result

Definition at line 1065 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ foldl() [1/2]

template<class Container , typename T >
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T FunctionalMethods< Container, T >::foldl ( const __T init,
Op &&  op = Op() 
) const
inline

Overload of foldl(const __T&, Op&) that accepts rvalues.

Template Parameters
__Taccumulator type (default T)
Parameters
[in]initinitial accumulator value
[in]opfolding operation
Returns
folded result

Definition at line 1052 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ foldl() [2/2]

template<class Container , typename T >
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T FunctionalMethods< Container, T >::foldl ( const __T init,
Op op 
) const
inline

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), then 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 from T, then you must specify the folded type as template parameter. For example, if you want to compute the sum of inverted elements, then 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

Definition at line 1034 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by demo_dynarray(), demo_functional(), demo_integration(), demo_vector_dynlist(), Aleph::format_string(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), Aleph::to_Pascalcase(), and TYPED_TEST_P().

◆ for_each() [1/4]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::for_each ( Operation &&  operation)
inline

Overload of for_each(Operation&) that accepts rvalues.

Definition at line 710 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ for_each() [2/4]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::for_each ( Operation &&  operation) const
inline

Overload of for_each(Operation&) const that accepts rvalues.

Definition at line 703 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ for_each() [3/4]

template<class Container , typename T >
template<class Operation >
FunctionalMethods< Container, T >::for_each ( Operation operation)
inline

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)

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

Parameters
[in]operationto be done on each element.
Exceptions
anythingthat can throw operation

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

Definition at line 685 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps(), and FunctionalMethods< Container, T >::me().

Referenced by Aleph::Matrix< Trow, Tcol, NumType >::Matrix(), OHashTest< HashTbl >::OHashTest(), Aleph::Random_Set< T >::Random_Set(), Aleph::Random_Set< T >::Random_Set(), SpecialCtors< Container, T >::SpecialCtors(), Aleph::Simplex< T >::~Simplex(), Aleph::HashSet< Key, HashSetTable, Cmp >::add(), Aleph::build_spanning_tree(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::build_tree(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::clear(), demo_city_coordinates(), demo_dynarray(), demo_dynlist(), demo_dynset_lhash(), demo_functional(), demo_grouping(), demo_iteration(), demo_modifiable_mapping(), demo_performance(), demo_practical(), demo_ranges(), demo_sieve_of_eratosthenes(), demo_simple_bloom_filter(), demo_subset_enumeration(), demo_variadic_constructor(), demo_zipping(), demonstrate_basic_operations(), demonstrate_functional(), demonstrate_functional_features(), demonstrate_ranked_operations(), Aleph::dyndlist_to_DynArray(), Aleph::dyndlist_to_DynList(), Aleph::dynlist_to_DynDlist(), FunctionalMethods< Container, T >::each(), FunctionalMethods< Container, T >::each(), Aleph::filter(), Aleph::format_string(), Aleph::join(), main(), Aleph::maptree_keys_to_DynList(), Aleph::maptree_to_Array(), Aleph::maptree_to_DynList(), Aleph::maptree_to_stdmap(), Aleph::maptree_values_to_DynList(), Aleph::Matrix< Trow, Tcol, NumType >::mult_matrix_vector_linear_comb(), Aleph::Matrix< Trow, Tcol, NumType >::mult_vector_matrix_linear_comb(), Aleph::Random_Set< T >::operator=(), SimpleQueue::print(), print_pairs(), GraphCommon< GT, Node, Arc >::remove_arcs_if(), Aleph::GraphCopyWithMapping< GT, Tree >::remove_node(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::remove_node(), Aleph::reverse(), Aleph::Matrix< Trow, Tcol, NumType >::set_vector_as_col(), Aleph::Matrix< Trow, Tcol, NumType >::set_vector_as_row(), Aleph::sethash_to_Array(), Aleph::sethash_to_DynArray(), Aleph::sethash_to_DynList(), Aleph::sethash_to_vector(), Aleph::settree_to_Array(), Aleph::settree_to_DynArray(), Aleph::settree_to_DynList(), Aleph::settree_to_stdset(), Aleph::settree_to_vector(), Aleph::shuffle(), Aleph::shuffle_ptr(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::sort_arcs(), 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::Matrix< Trow, Tcol, NumType >::to_collist(), Aleph::Matrix< Trow, Tcol, NumType >::to_rowlist(), Aleph::to_string(), TYPED_TEST_P(), and TYPED_TEST_P().

◆ for_each() [4/4]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::for_each ( Operation operation) const
inline

Const overload of for_each(Operation&).

Definition at line 696 of file ah-dry.H.

References FunctionalMethods< Container, T >::base(), and FunctionalMethods< Container, T >::maps().

◆ length()

template<class Container , typename T >
size_t FunctionalMethods< Container, T >::length ( ) const
inlinenoexcept

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 method size()
Returns
the number of elements stored in the container.

Definition at line 1385 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me().

Referenced by demo_grouping(), demo_prefix_search(), demo_spell_checker(), print_subheader(), Aleph::split(), and TEST().

◆ maps() [1/2]

template<class Container , typename T >
template<typename __T = T, class Operation = Aleph::Dft_Map_Op<__T, __T>>
Aleph::DynList< __T > FunctionalMethods< Container, T >::maps ( Operation &&  op) const
inline

Overload of maps(Operation&) that accepts rvalues.

Template Parameters
__Ttarget type (default T)
Parameters
[in]optransformation operation
Returns
DynList<__T> with mapped elements

Definition at line 921 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ maps() [2/2]

template<class Container , typename T >
template<typename __T = T, class Operation = Aleph::Dft_Map_Op<T, __T>>
Aleph::DynList< __T > FunctionalMethods< Container, T >::maps ( Operation &  op) const
inline

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. \throw anything that could throwoporbad_alloc` if there is no enough memory

Definition at line 904 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by Aleph::ArrayHeap< T, Compare >::ArrayHeap(), Aleph::DynDlist< T >::DynDlist(), Aleph::DynHashTable< Key, HashTable, Cmp >::DynHashTable(), Aleph::DynHashTable< Key, HashTable, Cmp >::DynHashTable(), Aleph::DynMapTree< Key, Data, Tree, Compare >::DynMapTree(), Aleph::DynSetTree< Key, Tree, Compare >::DynSetTree(), Aleph::DynSetTree< Key, Tree, Compare >::DynSetTree(), Aleph::DynSkipList< Key, Compare >::DynSkipList(), Aleph::DynSkipList< Key, Compare >::DynSkipList(), Aleph::DynSkipList< Key, Compare >::Node::Node(), Aleph::DynSkipList< Key, Compare >::Node::Node(), Aleph::DynSkipList< Key, Compare >::Node::Node(), Aleph::ODhashTable< Key, Cmp >::ODhashTable(), Aleph::ODhashTable< Key, Cmp >::ODhashTable(), Aleph::OLhashTable< Key, Cmp >::OLhashTable(), Aleph::ArrayHeap< T, Compare >::~ArrayHeap(), Aleph::DynSkipList< Key, Compare >::~DynSkipList(), Aleph::DynDlist< T >::__append(), Aleph::DynList< T >::__append(), Aleph::DynDlist< T >::__insert(), Aleph::DynList< T >::__insert(), FunctionalMethods< Container, T >::all(), FunctionalMethods< Container, T >::all(), Aleph::DynSkipList< Key, Compare >::all(), Aleph::DynSkipList< Key, Compare >::all(), Aleph::ODhashTable< Key, Cmp >::allocate_bucket(), Aleph::ODhashTable< Key, Cmp >::allocate_bucket(), Aleph::OLhashTable< Key, Cmp >::allocate_bucket(), Aleph::ArrayHeap< T, Compare >::allocate_storage(), Aleph::DynDlist< T >::Iterator::append(), Aleph::DynDlist< T >::Iterator::append(), Aleph::DynDlist< T >::Iterator::append_list(), Aleph::ODhashTable< Key, Cmp >::bucket_to_index(), Aleph::OLhashTable< Key, Cmp >::cleanup_deleted_chain(), Aleph::DynHashTable< Key, HashTable, Cmp >::copy(), Aleph::OLhashTable< Key, Cmp >::deallocate_bucket(), Aleph::ODhashTable< Key, Cmp >::deallocate_bucket_with_record(), Aleph::ODhashTable< Key, Cmp >::decrease_probe_counter(), Aleph::DynList< T >::Iterator::del(), Aleph::DynDlist< T >::Iterator::del(), Aleph::DynSetTree< Key, Tree, Compare >::del(), Aleph::DynSkipList< Key, Compare >::del(), demo_dynarray(), Aleph::DynSkipList< Key, Compare >::diff(), FunctionalMethods< Container, T >::drop(), FunctionalMethods< Container, T >::each(), FunctionalMethods< Container, T >::each(), FunctionalMethods< Container, T >::each(), FunctionalMethods< Container, T >::each(), FunctionalMethods< Container, T >::each(), FunctionalMethods< Container, T >::each(), FunctionalMethods< Container, T >::emplace(), FunctionalMethods< Container, T >::emplace_end(), FunctionalMethods< Container, T >::emplace_ins(), Aleph::DynDlist< T >::empty(), FunctionalMethods< Container, T >::exists(), FunctionalMethods< Container, T >::exists(), Aleph::DynSkipList< Key, Compare >::exists(), FunctionalMethods< Container, T >::filter(), FunctionalMethods< Container, T >::filter(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), Aleph::DynSetTree< Key, Tree, Compare >::find_position(), FunctionalMethods< Container, T >::fold(), FunctionalMethods< Container, T >::fold(), FunctionalMethods< Container, T >::fold_left(), FunctionalMethods< Container, T >::fold_left(), FunctionalMethods< Container, T >::foldl(), FunctionalMethods< Container, T >::foldl(), Aleph::DynSkipList< Key, Compare >::foldl(), Aleph::DynSkipList< Key, Compare >::foldl(), Aleph::DynSkipList< Key, Compare >::foldl(), Aleph::DynSkipList< Key, Compare >::for_each(), FunctionalMethods< Container, T >::for_each(), FunctionalMethods< Container, T >::for_each(), FunctionalMethods< Container, T >::for_each(), FunctionalMethods< Container, T >::for_each(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_in_preorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_inorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_inorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_postorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_postorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_preorder(), Aleph::DynSetTree< Key, Tree, Compare >::for_each_preorder(), Aleph::format_string(), Aleph::DynList< T >::get(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::get_data(), Aleph::DynMapTree< Key, Data, Tree, Compare >::get_data(), Aleph::DynMapTree< Key, Data, Tree, Compare >::get_data(), Aleph::DynMapTree< Key, Data, Tree, Compare >::get_key(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::get_key(), Aleph::DynMapTree< Key, Data, Tree, Compare >::get_key(), Aleph::ArrayHeap< T, Compare >::getMin(), Aleph::DynArrayHeap< T, Compare >::getMin(), Aleph::DynBinHeap< T, Compare >::getMin(), Aleph::ODhashTable< Key, Cmp >::hard_allocate_bucket(), Aleph::OLhashTable< Key, Cmp >::hard_allocate_bucket(), Aleph::DynArrayHeap< T, Compare >::Iterator::has_curr(), Aleph::ODhashTable< Key, Cmp >::index_backward(), Aleph::ODhashTable< Key, Cmp >::index_forward(), Aleph::DynSkipList< Key, Compare >::init(), Aleph::DynList< T >::insert(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynSkipList< Key, Compare >::insert(), Aleph::DynDlist< T >::Iterator::insert(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynSkipList< Key, Compare >::insert(), Aleph::DynDlist< T >::Iterator::insert(), Aleph::DynHashTable< Key, HashTable, Cmp >::insert_bucket(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::insert_in_graph(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::insert_in_graph(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::insert_in_graph(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::insert_in_graph(), Aleph::DynDlist< T >::Iterator::insert_list(), Aleph::DynSkipList< Key, Compare >::intersect(), Aleph::ODhashTable< Key, Cmp >::is_key_in_table(), Aleph::DynSkipList< Key, Compare >::Iterator::is_last(), Aleph::ODhashTable< Key, Cmp >::is_valid_bucket(), Aleph::OLhashTable< Key, Cmp >::is_valid_bucket(), Aleph::DynMapTree< Key, Data, Tree, Compare >::items_ptr(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::items_ptr(), Aleph::DynSkipList< Key, Compare >::join(), Aleph::ODhashTable< Key, Cmp >::key_in_table_to_bucket(), Aleph::DynHashTable< Key, HashTable, Cmp >::key_to_bucket(), Aleph::ODhashTable< Key, Cmp >::key_to_bucket(), Aleph::OLhashTable< Key, Cmp >::key_to_bucket(), Aleph::DynMapTree< Key, Data, Tree, Compare >::keys(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::keys(), Aleph::DynSkipList< Key, Compare >::keys_equal(), FunctionalMethods< Container, T >::maps(), FunctionalMethods< Container, T >::maps(), FunctionalMethods< Container, T >::maps_if(), FunctionalMethods< Container, T >::maps_if(), FunctionalMethods< Container, T >::mutable_for_each(), FunctionalMethods< Container, T >::mutable_for_each(), FunctionalMethods< Container, T >::nappend(), FunctionalMethods< Container, T >::ninsert(), FunctionalMethods< Container, T >::nnappend(), FunctionalMethods< Container, T >::nninsert(), Aleph::DynSkipList< Key, Compare >::none(), Aleph::DynSkipList< Key, Compare >::none(), Aleph::DynSetTree< Key, Tree, Compare >::Node_Op< Key_Op >::operator()(), Aleph::DynSkipList< Key, Compare >::Iterator::operator++(), Aleph::DynDlist< T >::operator=(), Aleph::DynHashTable< Key, HashTable, Cmp >::operator=(), Aleph::DynSetTree< Key, Tree, Compare >::operator=(), Aleph::DynSkipList< Key, Compare >::operator=(), Aleph::ODhashTable< Key, Cmp >::operator=(), Aleph::OLhashTable< Key, Cmp >::operator=(), Aleph::DynHashTable< Key, HashTable, Cmp >::operator=(), Aleph::DynSetTree< Key, Tree, Compare >::operator=(), Aleph::DynSkipList< Key, Compare >::operator=(), Aleph::ODhashTable< Key, Cmp >::operator=(), Aleph::OLhashTable< Key, Cmp >::operator=(), Aleph::DynMapTree< Key, Data, Tree, Compare >::operator[](), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::operator[](), Aleph::DynDlist< T >::operator[](), Aleph::DynMapTree< Key, Data, Tree, Compare >::operator[](), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::operator[](), FunctionalMethods< Container, T >::partition(), FunctionalMethods< Container, T >::partition(), FunctionalMethods< Container, T >::partition(), FunctionalMethods< Container, T >::pfilter(), FunctionalMethods< Container, T >::pfilter(), Aleph::DynSetTree< Key, Tree, Compare >::position(), FunctionalMethods< Container, T >::ptr_filter(), FunctionalMethods< Container, T >::ptr_filter(), Aleph::DynSkipList< Key, Compare >::random_level(), Aleph::DynList< T >::remove(), Aleph::DynMapTree< Key, Data, Tree, Compare >::remove(), Aleph::DynHashTable< Key, HashTable, Cmp >::remove(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::remove(), Aleph::DynSkipList< Key, Compare >::remove(), Aleph::ODhashTable< Key, Cmp >::remove(), Aleph::OLhashTable< Key, Cmp >::remove(), Aleph::DynList< T >::remove(), Aleph::DynMapTree< Key, Data, Tree, Compare >::remove(), Aleph::DynBinHeap< T, Compare >::remove(), Aleph::ArrayHeap< T, Compare >::remove(), Aleph::ODhashTable< Key, Cmp >::remove_bucket(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::remove_by_data(), Aleph::DynDlist< T >::remove_first_ne(), Aleph::DynMapTree< Key, Data, Tree, Compare >::remove_key(), Aleph::DynDlist< T >::remove_last_ne(), Aleph::DynList< T >::remove_ne(), Aleph::DynList< T >::remove_ne(), Aleph::DynSetTree< Key, Tree, Compare >::remove_pos(), FunctionalMethods< Container, T >::rev(), Aleph::DynList< T >::reverse(), Aleph::DynDlist< T >::reverse(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::search(), Aleph::DynMapTree< Key, Data, Tree, Compare >::search(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::search(), Aleph::DynSkipList< Key, Compare >::search(), Aleph::ODhashTable< Key, Cmp >::search(), Aleph::OLhashTable< Key, Cmp >::search(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::search(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::search(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::search(), Aleph::DynMapTree< Key, Data, Tree, Compare >::search(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::search(), Aleph::DynHashTable< Key, HashTable, Cmp >::search_or_insert(), Aleph::DynSkipList< Key, Compare >::search_or_insert(), Aleph::DynHashTable< Key, HashTable, Cmp >::search_or_insert(), Aleph::DynHashTable< Key, HashTable, Cmp >::search_or_insert_bucket(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::search_or_insert_in_graph(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::search_or_insert_in_graph(), Aleph::DynSetTree< Key, Tree, Compare >::select(), Aleph::DynSetTree< Key, Tree, Compare >::select(), Aleph::ODhashTable< Key, Cmp >::set_second_hash_fct(), Aleph::ODhashTable< Key, Cmp >::set_second_hash_fct(), Aleph::DynSkipList< Key, Compare >::set_seed(), FunctionalMethods< Container, T >::split_half(), Aleph::DynSetTree< Key, Tree, Compare >::split_key(), Aleph::DynDlist< T >::split_list(), Aleph::DynSetTree< Key, Tree, Compare >::split_pos(), Aleph::ODhashTable< Key, Cmp >::stats(), Aleph::OLhashTable< Key, Cmp >::stats(), Aleph::DynSetTree< Key, Tree, Compare >::swap(), Aleph::DynSkipList< Key, Compare >::swap(), Aleph::ODhashTable< Key, Cmp >::swap(), Aleph::OLhashTable< Key, Cmp >::swap(), FunctionalMethods< Container, T >::take(), FunctionalMethods< Container, T >::take(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), FunctionalMethods< Container, T >::to_dynlist(), FunctionalMethods< Container, T >::to_vector(), FunctionalMethods< Container, T >::tpartition(), FunctionalMethods< Container, T >::tpartition(), Aleph::DynSetTree< Key, Tree, Compare >::traverse(), Aleph::DynBinHeap< T, Compare >::traverse(), Aleph::DynSetTree< Key, Tree, Compare >::traverse(), Aleph::DynSkipList< Key, Compare >::traverse(), Aleph::ArrayHeap< T, Compare >::traverse(), Aleph::DynArrayHeap< T, Compare >::traverse(), Aleph::ArrayHeap< T, Compare >::traverse(), Aleph::DynArrayHeap< T, Compare >::traverse(), Aleph::DynSkipList< Key, Compare >::traverse(), Aleph::ArrayHeap< T, Compare >::traverse(), Aleph::DynArrayHeap< T, Compare >::traverse(), Aleph::ArrayHeap< T, Compare >::traverse(), Aleph::DynArrayHeap< T, Compare >::traverse(), Aleph::ArrayHeap< T, Compare >::traverse_impl(), TYPED_TEST_P(), TYPED_TEST_P(), Aleph::ArrayHeap< T, Compare >::update(), Aleph::ODhashTable< Key, Cmp >::Bucket::valid(), Aleph::DynMapTree< Key, Data, Tree, Compare >::values(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::values(), Aleph::DynMapTree< Key, Data, Tree, Compare >::values_ptr(), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::values_ptr(), and Aleph::DynSetTree< Key, Tree, Compare >::verify().

◆ maps_if() [1/2]

template<class Container , typename T >
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __T > FunctionalMethods< Container, T >::maps_if ( Prop  prop,
Operation &&  op 
) const
inline

Overload of maps_if(Prop, Operation&) that accepts rvalues.

Template Parameters
__Ttarget type (default T)
Parameters
[in]proppredicate
[in]optransformation operation
Returns
DynList<__T> with conditionally mapped elements

Definition at line 959 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ maps_if() [2/2]

template<class Container , typename T >
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __T > FunctionalMethods< Container, T >::maps_if ( Prop  prop,
Operation op 
) const
inline

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 performed 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 as the order of visit of the iterator for the container. \throw anything that could throwoporbad_alloc` if there is no enough memory

Definition at line 940 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ me()

◆ mutable_drop()

template<class Container , typename T >
void FunctionalMethods< Container, T >::mutable_drop ( const size_t  n)
inline

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

Definition at line 1488 of file ah-dry.H.

References FunctionalMethods< Container, T >::me().

◆ mutable_for_each() [1/2]

template<class Container , typename T >
template<class Operation >
void FunctionalMethods< Container, T >::mutable_for_each ( Operation &&  operation)
inline

Definition at line 798 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ mutable_for_each() [2/2]

template<class Container , typename T >
template<class Operation >
FunctionalMethods< Container, T >::mutable_for_each ( Operation operation)
inline

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

Definition at line 787 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps(), and FunctionalMethods< Container, T >::me().

Referenced by WorkersSet< WorkerFct >::~WorkersSet(), and Aleph::to_Pascalcase().

◆ nappend()

template<class Container , typename T >
template<typename ... Args>
size_t FunctionalMethods< Container, T >::nappend ( Args ...  args)
inline

Append n variadic items.

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

Definition at line 660 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps(), and FunctionalMethods< Container, T >::nnappend().

◆ ninsert()

template<class Container , typename T >
template<typename ... Args>
size_t FunctionalMethods< Container, T >::ninsert ( Args ...  args)
inline

Insert n variadic items.

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

Definition at line 647 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps(), and FunctionalMethods< Container, T >::nninsert().

◆ nnappend() [1/2]

template<class Container , typename T >
void FunctionalMethods< Container, T >::nnappend ( size_t )
inlineprivate

◆ nnappend() [2/2]

template<class Container , typename T >
template<typename ... Args>
void FunctionalMethods< Container, T >::nnappend ( size_t n,
const T &  item,
Args &...  args 
)
inlineprivate

◆ nninsert() [1/2]

template<class Container , typename T >
void FunctionalMethods< Container, T >::nninsert ( size_t )
inlineprivate

◆ nninsert() [2/2]

template<class Container , typename T >
template<typename ... Args>
void FunctionalMethods< Container, T >::nninsert ( size_t n,
const T &  item,
Args &...  args 
)
inlineprivate

◆ partition() [1/3]

template<class Container , typename T >
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > FunctionalMethods< Container, T >::partition ( Operation &&  op) const
inline

Overload of partition(Operation&) that accepts rvalues.

Parameters
[in]opfilter predicate
Returns
pair of lists (matched, not matched)

Definition at line 1285 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ partition() [2/3]

template<class Container , typename T >
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > FunctionalMethods< Container, T >::partition ( Operation op) const
inline

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 as 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()

Definition at line 1266 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by TEST_F(), TEST_F(), and TYPED_TEST_P().

◆ partition() [3/3]

template<class Container , typename T >
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > FunctionalMethods< Container, T >::partition ( size_t  n) const
inline

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

Definition at line 1301 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ pfilter() [1/2]

template<class Container , typename T >
template<class Operation >
Aleph::DynList< std::tuple< T, size_t > > FunctionalMethods< Container, T >::pfilter ( Operation &&  operation) const
inline

Overload of pfilter(Operation&) that accepts rvalues.

Parameters
[in]operationfilter predicate
Returns
DynList<std::tuple<T, size_t>> with matching elements and positions

Definition at line 1243 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ pfilter() [2/2]

template<class Container , typename T >
template<class Operation >
Aleph::DynList< std::tuple< T, size_t > > FunctionalMethods< Container, T >::pfilter ( Operation operation) const
inline

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)

Definition at line 1223 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), FunctionalMethods< Container, T >::maps(), and TT.

◆ ptr_filter() [1/2]

template<class Container , typename T >
template<class Operation >
Aleph::DynList< const T * > FunctionalMethods< Container, T >::ptr_filter ( Operation &&  operation) const
inline

Overload of ptr_filter(Operation&) that accepts rvalues.

Parameters
[in]operationfilter predicate
Returns
DynList<const T*> with pointers to matching elements

Definition at line 1198 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ ptr_filter() [2/2]

template<class Container , typename T >
template<class Operation >
Aleph::DynList< const T * > FunctionalMethods< Container, T >::ptr_filter ( Operation operation) const
inline

Filter the elements of a container according to a matching criteria and return a 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 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, then 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 filter 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

Definition at line 1181 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by TYPED_TEST_P().

◆ rev()

template<class Container , typename T >
Aleph::DynList< T > FunctionalMethods< Container, T >::rev ( ) const
inline

Return a list with the elements of container in reverse order respect to its traversal order.

Returns
a DynList<T> inversely ordered according to the traversal order.
Exceptions
bad_allocif there is no enough memory

Definition at line 1399 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by TEST_F(), and TEST_F().

◆ split_half()

template<class Container , typename T >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > FunctionalMethods< Container, T >::split_half ( ) const
inline

Split the container into two halves by alternating elements.

Elements at even positions go to the first list, odd positions to the second.

Returns
pair of lists (even‑indexed, odd‑indexed)

Definition at line 1321 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ take() [1/2]

template<class Container , typename T >
Aleph::DynList< T > FunctionalMethods< Container, T >::take ( const size_t  n) const
inline

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.

Definition at line 1418 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ take() [2/2]

template<class Container , typename T >
Aleph::DynList< T > FunctionalMethods< Container, T >::take ( size_t  i,
const size_t  j,
const size_t  step = 1 
) const
inline

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.

Definition at line 1444 of file ah-dry.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ to_dynlist()

template<class Container , typename T >
Aleph::DynList< T > FunctionalMethods< Container, T >::to_dynlist ( ) const
inline

Convert container to DynList.

Returns
DynList<T> containing all elements in traversal order.

Definition at line 968 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

Referenced by TYPED_TEST_P().

◆ to_vector()

template<class Container , typename T >
std::vector< T > FunctionalMethods< Container, T >::to_vector ( ) const
inline

Convert container to std::vector.

Returns
std::vector<T> containing all elements in traversal order.

Definition at line 977 of file ah-dry.H.

References FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

◆ tpartition() [1/2]

template<class Container , typename T >
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > FunctionalMethods< Container, T >::tpartition ( Operation &&  op) const
inline

Overload of tpartition(Operation&) that accepts rvalues.

Parameters
[in]opfilter predicate
Returns
tuple of lists (matched, not matched)

Definition at line 1369 of file ah-dry.H.

References FunctionalMethods< Container, T >::maps().

◆ tpartition() [2/2]

template<class Container , typename T >
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > FunctionalMethods< Container, T >::tpartition ( Operation op) const
inline

Exclusive partition of container according to a filter criteria.

This method has exactly the same semantic as 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 filtered elements andsecondthe non-filtered ones. \throw anything that could throw op orbad_alloc` if there is no enough memory
See also
partition(Operation & op)

Definition at line 1350 of file ah-dry.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::const_me(), and FunctionalMethods< Container, T >::maps().

Friends And Related Symbol Documentation

◆ each() [1/3]

template<class Container , typename T >
Aleph::each
related

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

◆ each() [2/3]

template<class Container , typename T >
Aleph::each
related

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

◆ each() [3/3]

template<class Container , typename T >
Aleph::each
related

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


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