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< Aleph::Gen_Euler_Tour_LCA::DepthEntry >, Aleph::Array< Node * >, Aleph::Array< Aleph::Array< size_t > >, Aleph::Array< value_type >, Aleph::Array< lazy_type >, Aleph::Array< Item >, Aleph::Array< Aleph::AABBTree::Node >, Aleph::Array< Aleph::AABBTree::Entry >, Aleph::Array< Aleph::AABBTree::DebugNode >, Aleph::Array< Aleph::AdversarialIterativeDeepeningIteration< Move, Score > >, Aleph::Array< Move >, Aleph::Array< Aleph::Aho_Corasick::Node >, Aleph::Array< std::string >, Aleph::Array< Aleph::Point >, Aleph::Array< Aleph::DelaunayTriangulationBowyerWatson::IndexedTriangle >, Aleph::Array< Aleph::Segment >, Aleph::Array< Aleph::Compact_Cuckoo_Filter::Bucket >, Aleph::Array< Aleph::ConstrainedDelaunayTriangulation::IndexedEdge >, Aleph::Array< Aleph::Convex_Hull_Trick::Line >, Aleph::Array< long double >, Aleph::Array< uint32_t >, Aleph::Array< Aleph::Cuckoo_Filter::Bucket >, Aleph::Array< Cost >, Aleph::Array< Complex >, Aleph::Array< Real >, Aleph::Array< Aleph::FFT::ISTFTProcessor >, Aleph::Array< Aleph::FFT::STFTProcessor >, Aleph::Array< Aleph::FFT::LFilter >, Aleph::Array< Aleph::Array< Real > >, Aleph::Array< bool >, Aleph::Array< Aleph::Array< Complex > >, Aleph::Array< Aleph::FFT::BiquadSection >, Aleph::Array< Aleph::FFT::IIRCoefficients >, Aleph::Array< Aleph::FFT::SOSFilter >, Aleph::Array< Aleph::detail::SPP_Portal >, Aleph::Array< Aleph::FunnelTraceStep >, Aleph::Array< char >, Aleph::Array< Aleph::lca_detail::Depth_Node >, Aleph::Array< Aleph::Gen_File_BPlus_Tree::Page >, Aleph::Array< unsigned char >, Aleph::Array< Aleph::Gen_File_B_Tree::Page >, Aleph::Array< typename GT::Node::Node_Type >, Aleph::Array< Aleph::Gen_Link_Cut_Tree::Node * >, Aleph::Array< Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeRec >, Aleph::Array< Aleph::Tree_Node * >, Aleph::Array< long >, Aleph::Array< uint8_t >, Aleph::Array< Aleph::IDAStarIteration< Distance > >, Aleph::Array< Aleph::KDTreePointSearch::DebugPartition >, Aleph::Array< std::optional< Move > >, Aleph::Array< Aleph::Array< Cost > >, Aleph::Array< Aleph::DynList< long > >, Aleph::Array< Aleph::Li_Chao_Tree::Node >, Aleph::Array< uint64_t >, Aleph::Array< Aleph::MonotonePolygonTriangulation::EdgeStatusTree::Node * >, Aleph::Array< Aleph::Naive_Suffix_Tree::Node >, Aleph::Array< Aleph::Planar_Dual_Metadata::Face_Boundary >, Aleph::Array< Aleph::Planar_Dual_Edge_Info< Aleph::List_Graph > >, Aleph::Array< Aleph::Planar_Dual_Metadata::Face_Dart >, Aleph::Array< Aleph::Planar_Geometric_Drawing::Node_Position >, Aleph::Array< Aleph::Planarity_Test_Result::Rotation_Entry >, Aleph::Array< Aleph::Array< Node * > >, Aleph::Array< Aleph::Planarity_Test_Result::Path_Witness >, Aleph::Array< Aleph::Planarity_Test_Result::Edge_Witness >, Aleph::Array< Arc * >, Aleph::Array< C >, Aleph::Array< Aleph::Polygon >, Aleph::Array< Aleph::PowerDiagram::WeightedSite >, Aleph::Array< Aleph::PowerDiagram::PowerEdge >, Aleph::Array< Aleph::PowerDiagram::PowerCell >, Aleph::Array< Aleph::RangeTree2D::Node >, Aleph::Array< Aleph::RangeTree2D::DebugNode >, Aleph::Array< Aleph::RegularTriangulationBowyerWatson::WeightedSite >, Aleph::Array< Aleph::SegmentArrangement::ArrEdge >, Aleph::Array< Aleph::SegmentArrangement::ArrFace >, Aleph::Array< Aleph::Segment_Tree_Beats::Node >, Aleph::Array< double >, Aleph::Array< Aleph::Suffix_Automaton::State >, Aleph::Array< Aleph::SweepLineSegmentIntersection::StatusTree::Node * >, Aleph::Array<::Polygon >, Aleph::Array<::Segment >, Aleph::Array<::Point >, Aleph::Array< Aleph::TrapezoidalMapPointLocation::Trapezoid >, Aleph::Array< Aleph::TrapezoidalMapPointLocation::DagNode >, Aleph::Array< __gmp_expr< mpq_t, mpq_t > >, Aleph::Array< Aleph::VoronoiDiagramFromDelaunay::Edge >, Aleph::Array< Aleph::VoronoiDiagramFromDelaunay::Cell >, Aleph::Array< VertexId >, Aleph::Array< Aleph::blossom_weighted_detail::mwmatching::impl::Blossom >, Aleph::Array< Aleph::blossom_weighted_detail::mwmatching::impl::Blossom * >, Aleph::Array< WeightType >, Aleph::Array< const Aleph::blossom_weighted_detail::mwmatching::Edge * >, Aleph::Array< Aleph::blossom_weighted_detail::mwmatching::Edge >, Aleph::Array< Aleph::Graph_Anode * >, Aleph::Array< Key >, Aleph::Array< std::unique_ptr< Aleph::detail::BPlusTreeNode > >, Aleph::Array< std::unique_ptr< Aleph::detail::BTreeNode > >, Aleph::Array< typename GT::Node * >, Aleph::Array< typename GT::Arc * >, Aleph::Array< Aleph::planarity_detail::Simple_Edge >, Aleph::Array< Aleph::Array< Arc * > >, Aleph::Array< Aleph::planarity_detail::Conflict_Pair >, 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< Aleph::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< VertexPair >, Aleph::DynDlist< Aleph::blossom_weighted_detail::mwmatching::impl::NonTrivialBlossom >, Aleph::DynDlist< Aleph::blossom_weighted_detail::mwmatching::impl::NonTrivialBlossom::SubBlossom >, Aleph::DynDlist< const Aleph::blossom_weighted_detail::mwmatching::Edge< WeightType > * >, 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::DynHashTable< std::pair< Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeKey, size_t >, Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeKeyEq, Dft_Pair_Cmp< Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeKey, size_t, Aleph::equal_to< Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeKey > > >, Aleph::DynHashTable< std::pair< Node *, int >, Aleph::Gen_Link_Cut_Tree_WithEdges::NodePtrEq, Dft_Pair_Cmp< Node *, int, Aleph::equal_to< Node * > > >, Aleph::DynIntervalTree< int >, Aleph::DynList< int >, Aleph::DynList< Event >, 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< long >, Aleph::DynList< typename GT::Node * >, Aleph::DynList< Aleph::Point >, Aleph::DynList< Solution >, Aleph::DynList< size_t >, Aleph::DynList< Aleph::Tree_Node * >, Aleph::DynList< std::pair< Node *, Aleph::Zero_One_BFS::Node_Info * > >, Aleph::DynList< std::pair< Node *, Aleph::Zero_One_BFS::Painted_Info * > >, Aleph::DynList< VertexId >, Aleph::DynList< Aleph::DynList< int > >, Aleph::DynList< QueueTheadsPool::ConsumerQueueEvent * >, Aleph::DynList< char >, Aleph::DynList< string >, Aleph::DynList< std::string >, Aleph::DynList< std::thread >, Aleph::DynListQueue< size_t >, Aleph::DynListQueue< VertexId >, 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< Aleph::Array< size_t >, double >, Aleph::Avl_Tree, Dft_Pair_Cmp< Aleph::Array< size_t >, double, Grevlex_Order > >, Aleph::DynSetTree< std::pair< size_t, double >, Avl_Tree, Dft_Pair_Cmp< size_t, double, Aleph::less< size_t > > >, 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< Aleph::LineSweepFramework::SeqEvent, Aleph::Avl_Tree, Aleph::LineSweepFramework::CmpSeqEvent >, 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< Aleph::VisibilityPolygon::EdgeStatusTree::EdgeKey, Aleph::Treap, Aleph::VisibilityPolygon::EdgeStatusTree::EdgeKeyCmp >, Aleph::DynSetTree< std::pair< Pair_Key, Arc * >, Avl_Tree, Dft_Pair_Cmp< Pair_Key, Arc *, Aleph::less< Pair_Key > > >, Aleph::DynSetTree< Arc * >, Aleph::DynSetTree< std::pair< Node *, Cost_Type >, Avl_Tree, Dft_Pair_Cmp< Node *, Cost_Type, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Node *, Arc * >, Avl_Tree, Dft_Pair_Cmp< Node *, Arc *, Aleph::less< 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::DynIntervalTree< T, Compare >, 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() const that accepts rvalues.
 
template<class Operation >
void for_each (Operation &&operation)
 Overload of for_each() 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 each() that accepts rvalues.
 
template<class Operation >
void each (Operation &&operation)
 Alias of each() 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)
 Apply a mutable operation to each element of the container.
 
template<class Operation >
void mutable_for_each (Operation &&operation)
 
template<class Operation >
bool all (Operation &operation) const
 Check if all the elements of the container satisfy a condition.
 
template<class Operation >
bool all (Operation &&operation) const
 Overload of all() that accepts rvalues.
 
template<class Operation >
bool exists (Operation &op) const
 Test for existence in the container of an element satisfying a criterion.
 
template<class Operation >
bool exists (Operation &&op) const
 Overload of exists() 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() that accepts rvalues.
 
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __T > maps_if (Prop prop, Operation &op) const
 Conditional mapping of the elements of the container.
 
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __T > maps_if (Prop prop, Operation &&op) const
 Overload of maps_if() 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() 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() 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() that accepts rvalues.
 
template<class Operation >
Aleph::DynList< T > filter (Operation &operation) const
 Filter the elements of a container according to a matching criterion.
 
template<class Operation >
Aleph::DynList< T > filter (Operation &&operation) const
 Overload of filter() 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 criterion 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() 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 criterion 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() 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 criterion.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &&op) const
 Overload of partition() that accepts rvalues.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (size_t n) const
 Exclusive partition of container in the nth item.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > split_half () const
 Split the container into two halves by alternating elements.
 
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &op) const
 Exclusive partition of container according to a filter criterion.
 
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &&op) const
 Overload of tpartition() 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 641 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationCallable with signature bool(const T &).
Parameters
[in]operationcondition to test.
Returns
true if all elements satisfy the condition.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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 the 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 criterion: false otherwise.
Exceptions
anythingthat could throw operation

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

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

Referenced by demonstrate_functional_features(), Aleph::Matrix< Trow, Tcol, NumType >::equal_to(), main(), TEST(), 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 645 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 1680 of file ah-dry.H.

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

Referenced by main(), TEST(), TEST(), and TYPED_TEST_P().

◆ 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 913 of file ah-dry.H.

◆ each() [2/6]

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

Alias of each() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationCallable with signature void(const T &).
Parameters
[in]operationto be performed on each item.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ each() [3/6]

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

Const alias of each() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationCallable with signature void(const T &).
Parameters
[in]operationto be performed on each item.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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 829 of file ah-dry.H.

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

◆ 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 836 of file ah-dry.H.

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

◆ 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 modifying the elements themselves, which could badly alter the internal state of the 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 894 of file ah-dry.H.

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

◆ 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 676 of file ah-dry.H.

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

◆ emplace_end()

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

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

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

◆ 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 the 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 the container. In general, this has some sense for lists and arrays, and it means insertion at the beginning of the sequence. On another type of container append() is equivalent to insert().
Parameters
[in]argsvariadic arguments list
Exceptions
bad_allocif there is no enough memory

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

References 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationCallable with signature bool(const T &).
Parameters
[in]oppredicate to test.
Returns
true if any element satisfies the predicate.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

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

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 993 of file ah-dry.H.

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

Referenced by demonstrate_functional_features(), Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::operator()(), TEST(), 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationFilter callable.
Parameters
[in]operationfilter predicate.
Returns
DynList<T> with matching elements.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

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

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

bool operation(const T & item)

If operation return true then item matches the criterion; 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 criterion
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 1319 of file ah-dry.H.

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

Referenced by demonstrate_functional_features(), Aleph::intercept(), TEST(), test_DynSet(), test_DynSetLinHash(), 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationFolding callable.
Parameters
[in]initinitial accumulator value.
[in]operationfolding operation.
Returns
folded result.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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 1267 of file ah-dry.H.

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

Referenced by main().

◆ 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
__Taccumulator type (default T).
OpFolding callable.
Parameters
[in]initinitial accumulator value.
[in]opfolding operation.
Returns
folded result.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

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

◆ 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 1237 of file ah-dry.H.

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

◆ 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
__Taccumulator type (default T).
OpFolding callable.
Parameters
[in]initinitial accumulator value.
[in]opfolding operation.
Returns
folded result.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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, 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, 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 1200 of file ah-dry.H.

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

Referenced by Aleph::format_string(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationCallable with signature void(const T &).
Parameters
[in]operationto be performed on each item.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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() const that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationCallable with signature void(const T &).
Parameters
[in]operationto be performed on each item.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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 allows 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 779 of file ah-dry.H.

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

Referenced by Aleph::Gen_Polynomial< Coefficient >::Gen_Polynomial(), 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::Two_Sat< GT >::add_at_most_one(), Aleph::build_spanning_tree(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::build_tree(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::clear(), Aleph::VoronoiDiagramFromDelaunay::clipped_cells(), Aleph::DynIntervalTree< T, Compare >::copy_from(), count_distinct_colors(), create_table(), demo_dynlist(), demo_dynset_lhash(), demo_functional(), demo_performance(), demo_practical(), demonstrate_functional_features(), Aleph::Gen_Polynomial< Coefficient >::divide_scalar_inplace(), 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::Gen_Polynomial< Coefficient >::from_roots(), main(), main(), Aleph::maphash_keys_to_DynList(), Aleph::maphash_to_Array(), Aleph::maphash_to_DynList(), Aleph::maphash_to_stdmap(), Aleph::maphash_values_to_DynList(), Aleph::maptree_keys_to_DynList(), Aleph::maptree_to_Array(), Aleph::maptree_to_DynList(), Aleph::maptree_to_stdmap(), Aleph::maptree_values_to_DynList(), Aleph::Gen_Polynomial< Coefficient >::multi_eval(), Aleph::Matrix< Trow, Tcol, NumType >::operator+=(), Aleph::Matrix< Trow, Tcol, NumType >::operator-=(), Aleph::Random_Set< T >::operator=(), SimpleQueue::print(), GraphCommon< GT, Node, Arc >::remove_arcs_if(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::remove_node(), Aleph::Gen_Polynomial< Coefficient >::remove_zeros(), Aleph::reverse(), roots_and_interpolation(), Aleph::Gen_Polynomial< Coefficient >::scale_inplace(), 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_F(), test_tree(), Aleph::Matrix< Trow, Tcol, NumType >::to_collist(), Aleph::Matrix< Trow, Tcol, NumType >::to_rowlist(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::to_str(), Aleph::GeomBowyerWatsonUtils::triangulate(), 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 790 of file ah-dry.H.

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

◆ 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 1598 of file ah-dry.H.

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

Referenced by demo_grouping(), and main().

◆ 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
__Ttarget type (default T).
OperationTransformation callable.
Parameters
[in]optransformation operation.
Returns
DynList<__T> with mapped elements.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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 1057 of file ah-dry.H.

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

Referenced by Aleph::format_string(), main(), TEST(), TEST_F(), TEST_F(), TEST_F(), FunctionalMethods< Container, T >::to_dynlist(), TYPED_TEST_P(), and TYPED_TEST_P().

◆ 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
__Ttarget type (default T).
PropPredicate callable.
OperationTransformation callable.
Parameters
[in]proppredicate.
[in]optransformation operation.
Returns
DynList<__T> with conditionally mapped elements.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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 1099 of file ah-dry.H.

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

◆ 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 1701 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 939 of file ah-dry.H.

◆ mutable_for_each() [2/2]

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

Apply a mutable operation to each element of the container.

Traverses the container and calls operation on every element, allowing the operation to modify each item in place.

Template Parameters
OperationCallable with signature void(T &).
Parameters
operationFunctor applied to each element; may modify it.
Exceptions
Anythingthat operation or the underlying traverse may throw.

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 928 of file ah-dry.H.

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

Referenced by WorkersSet< WorkerFct >::~WorkersSet().

◆ 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 754 of file ah-dry.H.

References 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 741 of file ah-dry.H.

References 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationFilter callable.
Parameters
[in]opfilter predicate.
Returns
pair of lists (matched, not matched).
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

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

partition(op) traverses the container and filters its elements according to the filter criterion 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 criterion
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 1468 of file ah-dry.H.

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

Referenced by TEST_F(), and TEST_F().

◆ partition() [3/3]

template<class Container , typename T >
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 1508 of file ah-dry.H.

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

◆ 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationFilter callable.
Parameters
[in]operationfilter predicate.
Returns
DynList<std::tuple<T, size_t>> with matching elements and positions.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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 criterion 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 criterion
Returns
a DynList
Exceptions
bad_allocif there is no enough memory
See also
filter(Operation & operation)

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

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::const_me(), 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationFilter callable.
Parameters
[in]operationfilter predicate.
Returns
DynList<const T*> with pointers to matching elements.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

◆ 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 criterion 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 criterion defined by operation, which should have the following signature:

bool operation(const T & item)

If operation return true then item matches the criterion; 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 criterion
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 1371 of file ah-dry.H.

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

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 1612 of file ah-dry.H.

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

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 1528 of file ah-dry.H.

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

◆ 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 1631 of file ah-dry.H.

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

Referenced by main(), TEST(), TEST(), TEST(), and TYPED_TEST_P().

◆ 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 1657 of file ah-dry.H.

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

◆ 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 1134 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 1143 of file ah-dry.H.

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

◆ 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationFilter callable.
Parameters
[in]opfilter predicate.
Returns
tuple of lists (matched, not matched).
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

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

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

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 criterion
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 1557 of file ah-dry.H.

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

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: