Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
GenericTraverse< Container > Struct Template Reference

Generic traversal of the container through its iterator. More...

#include <ah-dry.H>

Inherited by 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< GT_Node *, size_t >, LhashTable, Dft_Pair_Cmp< GT_Node *, size_t, Aleph::equal_to< GT_Node * > > >, Aleph::DynHashTable< std::pair< Key, T >, LhashTable, Dft_Pair_Cmp< Key, T, Cmp > >, 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::DynList< int >, Aleph::DynList< Event >, Aleph::DynList< std::pair< size_t, size_t > >, Aleph::DynList< typename GT::Node * >, 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< GT_Arc * >, Aleph::DynList< Aleph::Point >, Aleph::DynList< Solution >, Aleph::DynList< size_t >, Aleph::DynList< Aleph::DynList< typename GT::Node * > >, Aleph::DynList< Aleph::Tree_Node * >, Aleph::DynList< std::string >, Aleph::DynList< Pair >, Aleph::DynList< std::pair< Node *, Aleph::Zero_One_BFS::Node_Info * > >, Aleph::DynList< VertexId >, Aleph::DynList< Df_Low_Non_Tree_Arc >, Aleph::DynList< Aleph::DynList< int > >, Aleph::DynList< QueueTheadsPool::ConsumerQueueEvent * >, Aleph::DynList< char >, Aleph::DynList< string >, Aleph::DynList< std::thread >, Aleph::DynSkipList< int >, Aleph::ODhashTable< P, AhHashDispatcher::Equal >, Aleph::ODhashTable< int >, Aleph::OLhashTable< int >, Aleph::DynDlist< T >, Aleph::DynHashTable< Key, HashTable, Cmp >, Aleph::DynList< T >, Aleph::DynSkipList< Key, Compare >, Aleph::ODhashTable< Key, Cmp >, and Aleph::OLhashTable< Key, Cmp >.

Public Member Functions

template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_arg<Container, Operation>::type>
bool traverse (Operation &operation) noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_arg< Container, Operation >::type, Container & >())
 Traverse the container via its iterator and performs a conditioned operation on each item.
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_carg<Container, Operation>::type>
bool traverse (Operation &operation) const noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_carg< Container, Operation >::type, const_source_t< Operation > >())
 Traverse a constant container; each item is handed out as a constant reference.
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_carg<Container, Operation>::type>
bool traverse (Operation &&operation) const noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_carg< Container, Operation >::type, const_source_t< Operation > >())
 Overload of traverse(Operation &) const that accepts rvalues.
 
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_arg<Container, Operation>::type>
bool traverse (Operation &&operation) noexcept(traverse_is_noexcept< Operation, typename Aleph::concepts_detail::traverse_arg< Container, Operation >::type, Container & >())
 Overload of traverse(Operation &) that accepts rvalues.
 

Private Types

template<class Deferred >
using const_source_t = std::conditional_t< std::is_constructible_v< typename Aleph::concepts_detail::defer< Container, Deferred >::type::Iterator, const typename Aleph::concepts_detail::defer< Container, Deferred >::type & >, const typename Aleph::concepts_detail::defer< Container, Deferred >::type &, typename Aleph::concepts_detail::defer< Container, Deferred >::type & >
 

Static Private Member Functions

template<class Operation , class Arg , class Source >
static constexpr bool traverse_is_noexcept () noexcept
 

Detailed Description

template<class Container>
struct GenericTraverse< Container >

Generic traversal of the container through its iterator.

This class implements a conditioned traversal on the container through its iterator.

It is assumed that Container exports its iterator with

typename Container::Iterator

The modifiable traversal hands out what the iterator's get_curr() returns; the constant one hands out each item as const T &.

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

Member Typedef Documentation

◆ const_source_t

template<class Container >
template<class Deferred >
using GenericTraverse< Container >::const_source_t = std::conditional_t<std::is_constructible_v< typename Aleph::concepts_detail::defer<Container, Deferred>::type::Iterator, const typename Aleph::concepts_detail::defer<Container, Deferred>::type &>, const typename Aleph::concepts_detail::defer<Container, Deferred>::type &, typename Aleph::concepts_detail::defer<Container, Deferred>::type &>
private

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

Member Function Documentation

◆ traverse() [1/4]

template<class Container >
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_carg<Container, Operation>::type>
bool GenericTraverse< Container >::traverse ( Operation &&  operation) const
inlinenoexcept

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

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

Parameters
[in]operationto be performed on each item.
Returns
true if all the items were visited; false otherwise.
Exceptions
anythingthat operation throws.

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

◆ traverse() [2/4]

template<class Container >
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_arg<Container, Operation>::type>
bool GenericTraverse< Container >::traverse ( Operation &&  operation)
inlinenoexcept

Overload of traverse(Operation &) that accepts rvalues.

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

Parameters
[in]operationto be performed on each item.
Returns
true if all the items were visited; false otherwise.
Exceptions
anythingthat operation throws.

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

◆ traverse() [3/4]

template<class Container >
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_carg<Container, Operation>::type>
bool GenericTraverse< Container >::traverse ( Operation &  operation) const
inlinenoexcept

Traverse a constant container; each item is handed out as a constant reference.

operation must accept const Item_Type &: an operation that needs to modify the item does not compile on a constant container.

Parameters
[in]operationto be performed on each item.
Returns
true if all the items were visited; false if operation stopped the traversal.
Exceptions
anythingthat operation throws.

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

References Aleph::dry_detail::advance(), Aleph::dry_detail::current(), and Aleph::iterator_for().

◆ traverse() [4/4]

template<class Container >
template<class Operation >
requires Aleph::PredicateWith<Operation &, typename Aleph::concepts_detail::traverse_arg<Container, Operation>::type>
bool GenericTraverse< Container >::traverse ( Operation &  operation)
inlinenoexcept

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

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

operation must have the following signature:

bool operation(typename Container::Item_Type & item)

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

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

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

References Aleph::dry_detail::advance(), and Aleph::dry_detail::current().

Referenced by demo_iteration(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), Aleph::DynListQueue< T >::traverse(), Aleph::DynListStack< T >::traverse(), Aleph::DynListQueue< T >::traverse(), Aleph::DynListStack< T >::traverse(), Aleph::DynListQueue< T >::traverse(), Aleph::DynListStack< T >::traverse(), Aleph::DynListQueue< T >::traverse(), and Aleph::DynListStack< T >::traverse().

◆ traverse_is_noexcept()

template<class Container >
template<class Operation , class Arg , class Source >
static constexpr bool GenericTraverse< Container >::traverse_is_noexcept ( )
inlinestaticconstexprprivatenoexcept

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


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