Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Filter_Iterator< Container, It, Show_Item > Class Template Reference

Generic filter iterator wrapper. More...

#include <filter_iterator.H>

Inheritance diagram for Aleph::Filter_Iterator< Container, It, Show_Item >:
[legend]
Collaboration diagram for Aleph::Filter_Iterator< Container, It, Show_Item >:
[legend]

Public Types

using Item_Type = typename It::Item_Type
 The type of element returned by get_curr()
 
using Iterator_Type = It
 The type of the base iterator.
 
using Container_Type = Container
 The type of container being iterated.
 
using Filter_Type = Show_Item
 The type of the filter functor.
 

Public Member Functions

const Container & get_container () const
 Returns a const reference to the container being iterated over.
 
bool has_container () const noexcept
 Check if a container has been set.
 
It & get_iterator () noexcept
 Returns a reference to the underlying base iterator.
 
const It & get_iterator () const noexcept
 Returns a const reference to the underlying base iterator.
 
Show_Item & get_filter () noexcept
 Returns a reference to the filter functor.
 
const Show_Item & get_filter () const noexcept
 Returns a const reference to the filter functor.
 
void set_filter (Show_Item si)
 Sets a new filter functor.
 
void set_cookie (void *__cookie) noexcept
 Sets the cookie pointer.
 
void * get_cookie () const noexcept
 Gets the cookie pointer.
 
 Filter_Iterator (Show_Item si=Show_Item()) noexcept
 Default constructor.
 
 Filter_Iterator (const Container &c, Show_Item si=Show_Item())
 Constructs a filter iterator over a container.
 
 Filter_Iterator (Container &c, Show_Item si=Show_Item())
 Filter over the modifiable container c.
 
 Filter_Iterator (const Container &c, void *__cookie, Show_Item si=Show_Item())
 Constructs a filter iterator with a cookie.
 
 Filter_Iterator (Container &c, void *__cookie, Show_Item si=Show_Item())
 See Filter_Iterator(const Container &, void *, Show_Item); over a modifiable container.
 
void next ()
 Advances the iterator to the next filtered element.
 
void next_ne () noexcept(shows_ne)
 Advances the iterator to the next filtered element, as next() does.
 
void prev ()
 Moves the iterator backward to the previous filtered element.
 
void prev_ne () noexcept(shows_ne)
 Moves the iterator backward, as prev() does.
 
void reset_first ()
 Resets the iterator to the first filtered element.
 
void reset_last ()
 Resets the iterator to the last filtered element.
 
size_t count ()
 Count the number of elements that pass the filter.
 
bool empty ()
 Check if there are no elements that pass the filter.
 
template<typename Op >
void for_each (Op op)
 Apply a function to all filtered elements.
 
template<typename Pred >
bool find_if (Pred pred)
 Find the first element that satisfies an additional predicate.
 

Static Public Attributes

static constexpr bool goes_back = requires (It & i) { i.prev(); }
 Whether the base iterator moves back, as prev() and prev_ne() need.
 
static constexpr bool goes_to_last = requires (It & i) { i.reset_last(); i.prev(); }
 Whether the base iterator goes to its last item and moves back, as reset_last() needs.
 

Private Member Functions

bool container_set () const noexcept
 
decltype(auto) base_curr ()
 
void goto_first_valid_item ()
 Advance to the first element that passes the filter.
 
void forward_without_curr ()
 
void forward ()
 Move forward to the next element that passes the filter.
 
void goto_last_valid_item ()
 Move to the last element that passes the filter.
 
void backward ()
 Move backward to the previous element that passes the filter.
 

Static Private Member Functions

static auto kept (const Container &c) noexcept
 

Private Attributes

Show_Item show_item
 
std::conditional_t< keeps_copy, Container, const Container * > container_ptr {}
 
void * cookie = nullptr
 User-defined pointer for extensibility (e.g., passing context data to filter)
 

Static Private Attributes

static constexpr bool keeps_copy = filter_iterator_keeps_copy<Container>
 
static constexpr bool shows_ne
 
static constexpr bool unchecked = AlephUncheckedIterator<It>
 

Detailed Description

template<class Container, class It, class Show_Item>
class Aleph::Filter_Iterator< Container, It, Show_Item >

Generic filter iterator wrapper.

Filter_Iterator wraps an existing iterator and filters elements based on a user-defined predicate. Only elements that satisfy the filter predicate are visible during iteration.

This class is parameterized by the following types:

  • Container: A container type from the Aleph library (e.g., DynList, DynArray, DynSetTree).
  • It: An iterator class that must belong to the Container type. Since there may be several iterator classes associated with a container (Container::Iterator, Container::Rev_Iterator, etc.), this parameter allows selecting which one to use.
  • Show_Item: A functor class that determines whether an element should be visible through the iterator. The filter criterion is implemented via the boolean call Show_Item::operator()(Item_Type) which must return true if the element should be shown, or false otherwise.

The purpose of Filter_Iterator is to provide a generic iterator that filters elements according to a criterion defined by the Show_Item class. This allows generic algorithms using Filter_Iterator to have different behaviors depending on the Show_Item filter.

Aleph containers export two important types in the context of Filter_Iterator: Set_Type and Item_Type, which correspond to the type of container being iterated over and the type of element returned by the iterator It, respectively.

Usage example:

// Define a filter that shows only even numbers
struct ShowEven {
bool operator()(int x) const { return x % 2 == 0; }
};
DynList<int> list;
list.append(1); list.append(2); list.append(3);
list.append(4); list.append(5); list.append(6);
Filter_Iterator<DynList<int>, DynList<int>::Iterator, ShowEven> it(list);
for (; it.has_curr(); it.next())
std::cout << it.get_curr() << " "; // Prints: 2 4 6
Template Parameters
ContainerThe container type being iterated over. Must be an Aleph container type that supports iteration.
ItThe base iterator type for the container. Should be one of the iterator classes provided by Container.
Show_ItemA functor class that determines element visibility. Must provide: bool operator()(const Item_Type&) that returns true if the item should be shown, false otherwise.
Warning
This class is designed for Aleph containers and does not work with the standard library (std).
This class is not thread-safe. Concurrent access from multiple threads requires external synchronization.
Note
next() past the last item and prev() before the first leave the iterator where it is: the iterator catches the std::overflow_error and std::underflow_error of the base iterator there. What the filter throws goes out of every member that calls it, next_ne() and prev_ne() included, which are noexcept only when the filter is; the iterator stays then on the item on which the filter threw.
Author
Leandro Rabindranath León

Definition at line 146 of file filter_iterator.H.

Member Typedef Documentation

◆ Container_Type

template<class Container , class It , class Show_Item >
using Aleph::Filter_Iterator< Container, It, Show_Item >::Container_Type = Container

The type of container being iterated.

Definition at line 321 of file filter_iterator.H.

◆ Filter_Type

template<class Container , class It , class Show_Item >
using Aleph::Filter_Iterator< Container, It, Show_Item >::Filter_Type = Show_Item

The type of the filter functor.

Definition at line 324 of file filter_iterator.H.

◆ Item_Type

template<class Container , class It , class Show_Item >
using Aleph::Filter_Iterator< Container, It, Show_Item >::Item_Type = typename It::Item_Type

The type of element returned by get_curr()

Definition at line 315 of file filter_iterator.H.

◆ Iterator_Type

template<class Container , class It , class Show_Item >
using Aleph::Filter_Iterator< Container, It, Show_Item >::Iterator_Type = It

The type of the base iterator.

Definition at line 318 of file filter_iterator.H.

Constructor & Destructor Documentation

◆ Filter_Iterator() [1/5]

template<class Container , class It , class Show_Item >
Aleph::Filter_Iterator< Container, It, Show_Item >::Filter_Iterator ( Show_Item  si = Show_Item())
inlinenoexcept

Default constructor.

Creates a filter iterator with only a filter functor. The container must be set later by copy/assignment from another iterator that has a container.

Warning
Calling get_container() on a default-constructed iterator will throw std::domain_error.
Parameters
siThe filter functor to use (default constructed if not provided).

Definition at line 419 of file filter_iterator.H.

◆ Filter_Iterator() [2/5]

template<class Container , class It , class Show_Item >
Aleph::Filter_Iterator< Container, It, Show_Item >::Filter_Iterator ( const Container &  c,
Show_Item  si = Show_Item() 
)
inline

Constructs a filter iterator over a container.

The iterator is automatically positioned at the first element that passes the filter predicate.

Parameters
cThe container to iterate over.
siThe filter functor to use (default constructed if not provided).
Exceptions
std::bad_allocif there is not enough memory.
anythingthat the filter throws.

Definition at line 435 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::goto_first_valid_item().

◆ Filter_Iterator() [3/5]

template<class Container , class It , class Show_Item >
Aleph::Filter_Iterator< Container, It, Show_Item >::Filter_Iterator ( Container &  c,
Show_Item  si = Show_Item() 
)
inline

Filter over the modifiable container c.

Parameters
[in]cthe container.
[in]sithe filter.
Exceptions
anythingthat the filter throws.

Definition at line 446 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::goto_first_valid_item().

◆ Filter_Iterator() [4/5]

template<class Container , class It , class Show_Item >
Aleph::Filter_Iterator< Container, It, Show_Item >::Filter_Iterator ( const Container &  c,
void *  __cookie,
Show_Item  si = Show_Item() 
)
inline

Constructs a filter iterator with a cookie.

The cookie is a user-defined pointer that can be used to attach arbitrary data to the iterator for extensibility purposes.

Parameters
cThe container to iterate over.
__cookieUser-defined pointer for extensibility.
siThe filter functor to use (default constructed if not provided).
Exceptions
std::bad_allocif there is not enough memory.

Definition at line 462 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::cookie.

◆ Filter_Iterator() [5/5]

template<class Container , class It , class Show_Item >
Aleph::Filter_Iterator< Container, It, Show_Item >::Filter_Iterator ( Container &  c,
void *  __cookie,
Show_Item  si = Show_Item() 
)
inline

See Filter_Iterator(const Container &, void *, Show_Item); over a modifiable container.

Definition at line 470 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::cookie.

Member Function Documentation

◆ backward()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::backward ( )
inlineprivate

Move backward to the previous element that passes the filter.

First moves back past the current element, then continues moving backward until finding an element that satisfies the filter predicate, or until reaching the beginning of the sequence.

Before the first item, the base iterator throws std::underflow_error, and the iterator stays there; what the filter throws goes out.

Definition at line 286 of file filter_iterator.H.

References Aleph::and, Aleph::HTList::Iterator::get_curr(), Aleph::HTList::Iterator::has_curr(), Aleph::Filter_Iterator< DynList< int >, DynList< int >::Iterator, Par >::prev(), and Aleph::Filter_Iterator< Container, It, Show_Item >::show_item.

Referenced by Aleph::Filter_Iterator< Container, It, Show_Item >::prev(), and Aleph::Filter_Iterator< Container, It, Show_Item >::prev_ne().

◆ base_curr()

◆ container_set()

◆ count()

template<class Container , class It , class Show_Item >
size_t Aleph::Filter_Iterator< Container, It, Show_Item >::count ( )
inline

Count the number of elements that pass the filter.

Iterates through the entire sequence and counts elements that satisfy the filter predicate. This is a destructive operation that modifies the iterator position.

Returns
The number of filtered elements.
Note
After calling this method, the iterator position is undefined. Call reset_first() to reposition.

Definition at line 547 of file filter_iterator.H.

References Aleph::has_curr(), Aleph::Filter_Iterator< Container, It, Show_Item >::next(), and Aleph::Filter_Iterator< Container, It, Show_Item >::reset_first().

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

◆ empty()

template<class Container , class It , class Show_Item >
bool Aleph::Filter_Iterator< Container, It, Show_Item >::empty ( )
inline

Check if there are no elements that pass the filter.

Resets the iterator to the first position and checks if any element passes the filter.

Returns
true if no elements pass the filter, false otherwise.
Note
This modifies the iterator position. Call reset_first() after if you need to iterate.

Definition at line 564 of file filter_iterator.H.

References Aleph::has_curr(), and Aleph::Filter_Iterator< Container, It, Show_Item >::reset_first().

Referenced by TEST().

◆ find_if()

template<class Container , class It , class Show_Item >
template<typename Pred >
bool Aleph::Filter_Iterator< Container, It, Show_Item >::find_if ( Pred  pred)
inline

Find the first element that satisfies an additional predicate.

Searches through filtered elements until finding one that also satisfies the given predicate.

Template Parameters
PredA callable type that accepts Item_Type and returns bool.
Parameters
predThe additional predicate to check.
Returns
true if an element was found, false otherwise.
Note
If found, the iterator is positioned at that element. If not found, has_curr() returns false.

Definition at line 603 of file filter_iterator.H.

References Aleph::get_curr(), Aleph::has_curr(), Aleph::Filter_Iterator< Container, It, Show_Item >::next(), pred, and Aleph::Filter_Iterator< Container, It, Show_Item >::reset_first().

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

◆ for_each()

template<class Container , class It , class Show_Item >
template<typename Op >
void Aleph::Filter_Iterator< Container, It, Show_Item >::for_each ( Op  op)
inline

Apply a function to all filtered elements.

Iterates through all elements that pass the filter and applies the given operation to each one.

Template Parameters
OpA callable type that accepts Item_Type.
Parameters
opThe operation to apply to each filtered element.
Note
This modifies the iterator position.
it.for_each([](int x) { std::cout << x << " "; });
Iterator on the items of list.
Definition htlist.H:1614
Generic filter iterator wrapper.

Definition at line 585 of file filter_iterator.H.

References Aleph::get_curr(), Aleph::has_curr(), Aleph::Filter_Iterator< Container, It, Show_Item >::next(), and Aleph::Filter_Iterator< Container, It, Show_Item >::reset_first().

Referenced by TEST(), and TEST().

◆ forward()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::forward ( )
inlineprivate

Move forward to the next element that passes the filter.

First advances past the current element, then continues advancing until finding an element that satisfies the filter predicate, or until reaching the end of the sequence.

Past the end, the base iterator throws std::overflow_error, and the iterator stays there; what the filter throws goes out.

Definition at line 235 of file filter_iterator.H.

References Aleph::and, Aleph::Filter_Iterator< Container, It, Show_Item >::forward_without_curr(), Aleph::HTList::Iterator::get_curr_ne(), Aleph::Filter_Iterator< Container, It, Show_Item >::goto_first_valid_item(), Aleph::HTList::Iterator::has_curr(), Aleph::Filter_Iterator< DynList< int >, DynList< int >::Iterator, Par >::next(), Aleph::Filter_Iterator< DynList< int >, DynList< int >::Iterator, Par >::next_ne(), Aleph::Filter_Iterator< Container, It, Show_Item >::show_item, and Aleph::Filter_Iterator< Container, It, Show_Item >::unchecked.

Referenced by Aleph::Filter_Iterator< Container, It, Show_Item >::next(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().

◆ forward_without_curr()

◆ get_container()

template<class Container , class It , class Show_Item >
const Container & Aleph::Filter_Iterator< Container, It, Show_Item >::get_container ( ) const
inline

Returns a const reference to the container being iterated over.

Returns
Const reference to the container.
Exceptions
std::domain_errorif the iterator was default-constructed without a container.

Definition at line 332 of file filter_iterator.H.

References ah_domain_error_if, Aleph::Filter_Iterator< Container, It, Show_Item >::container_ptr, Aleph::Filter_Iterator< Container, It, Show_Item >::container_set(), and Aleph::Filter_Iterator< Container, It, Show_Item >::keeps_copy.

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

◆ get_cookie()

template<class Container , class It , class Show_Item >
void * Aleph::Filter_Iterator< Container, It, Show_Item >::get_cookie ( ) const
inlinenoexcept

Gets the cookie pointer.

Returns
The current cookie value.

Definition at line 406 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::cookie.

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

◆ get_filter() [1/2]

template<class Container , class It , class Show_Item >
const Show_Item & Aleph::Filter_Iterator< Container, It, Show_Item >::get_filter ( ) const
inlinenoexcept

Returns a const reference to the filter functor.

Returns
Const reference to the filter functor.

Definition at line 375 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::show_item.

◆ get_filter() [2/2]

template<class Container , class It , class Show_Item >
Show_Item & Aleph::Filter_Iterator< Container, It, Show_Item >::get_filter ( )
inlinenoexcept

Returns a reference to the filter functor.

Use this function if you need to access or modify the filter state. Note that the filter object will be destroyed when the ~Filter_Iterator() destructor is called.

Returns
Reference to the filter functor.

Definition at line 369 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::show_item.

Referenced by TEST(), and TYPED_TEST().

◆ get_iterator() [1/2]

template<class Container , class It , class Show_Item >
const It & Aleph::Filter_Iterator< Container, It, Show_Item >::get_iterator ( ) const
inlinenoexcept

Returns a const reference to the underlying base iterator.

Returns
Const reference to the base iterator.

Definition at line 359 of file filter_iterator.H.

◆ get_iterator() [2/2]

template<class Container , class It , class Show_Item >
It & Aleph::Filter_Iterator< Container, It, Show_Item >::get_iterator ( )
inlinenoexcept

Returns a reference to the underlying base iterator.

This provides access to the base iterator functionality if needed.

Returns
Reference to the base iterator.

Definition at line 353 of file filter_iterator.H.

Referenced by TEST().

◆ goto_first_valid_item()

◆ goto_last_valid_item()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::goto_last_valid_item ( )
inlineprivate

Move to the last element that passes the filter.

Positions the iterator at the end, then moves backward until finding an element that satisfies the filter predicate, or until reaching the beginning of the sequence.

The base iterator moves only from an item, which does not throw; what the filter throws goes out.

Definition at line 269 of file filter_iterator.H.

References Aleph::and, Aleph::HTList::Iterator::get_curr(), Aleph::HTList::Iterator::has_curr(), Aleph::Filter_Iterator< DynList< int >, DynList< int >::Iterator, Par >::prev(), Aleph::Filter_Iterator< DynList< int >, DynList< int >::Iterator, Par >::reset_last(), and Aleph::Filter_Iterator< Container, It, Show_Item >::show_item.

Referenced by Aleph::Filter_Iterator< Container, It, Show_Item >::reset_last().

◆ has_container()

template<class Container , class It , class Show_Item >
bool Aleph::Filter_Iterator< Container, It, Show_Item >::has_container ( ) const
inlinenoexcept

Check if a container has been set.

Returns
true if the iterator has a container, false otherwise.

Definition at line 345 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::container_set().

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

◆ kept()

template<class Container , class It , class Show_Item >
static auto Aleph::Filter_Iterator< Container, It, Show_Item >::kept ( const Container &  c)
inlinestaticprivatenoexcept

◆ next()

◆ next_ne()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne ( )
inlinenoexcept

Advances the iterator to the next filtered element, as next() does.

Exceptions
anythingthat the filter throws, as next(); next_ne() is noexcept when the filter is.

Definition at line 493 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::forward().

Referenced by Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA >::Floyd_All_Shortest_Paths(), Aleph::In_Arcs_Index< GT, SA >::In_Arcs_Index(), Aleph::hamiltonian_detail::Simple_Graph< GT, SA >::Simple_Graph(), Aleph::Test_Eulerian< GT, SN, SA >::analyze_digraph(), Aleph::Test_Eulerian< GT, SN, SA >::analyze_graph(), Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA >::append_lightest_arc(), Aleph::arcs(), Aleph::eulerian_detail::arcs_are_together(), Aleph::Breadth_First_Traversal< GT, Operation, SA >::bft(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::build_adjacency(), Aleph::tree_dp_detail::Tree_Topology< GT, SA >::build_adjacency(), Aleph::GraphCopyWithMapping< GT, Tree >::build_copy(), Aleph::IndexArc< GT, Tree, SA >::build_index(), Aleph::IndexNode< GT, Compare, Tree, SN >::build_index(), Aleph::Karger_Min_Cut< GT, SA >::build_kgraph(), Aleph::build_level_graph(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::build_node_index(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::tree_decomposition_detail::Rooted_Tree_Topology< GT, SA >::build_simple_adjacency(), Aleph::Network_Simplex< Net >::build_spanning_tree(), Aleph::k_shortest_paths_detail::build_suffix_index_digraph(), Aleph::k_shortest_paths_detail::build_suffix_index_with_itor(), Aleph::Find_Breadth_First_Spanning_Tree< GT, SA >::build_tree(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_underlying_simple_graph(), Aleph::capacity_scaling_maximum_flow(), Aleph::Path< GT >::check(), Aleph::Path< GT >::check_directed(), Aleph::clear_graph(), Aleph::compute_bipartite(), Aleph::compute_bipartite_all_components(), Aleph::compute_flow_statistics(), Aleph::compute_maximum_cardinality_bipartite_matching(), Aleph::compute_maximum_weight_general_matching(), Aleph::compute_min_cut(), Aleph::Path< GT >::contains_arc(), Aleph::Path< GT >::contains_node(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Copy_Graph< GT, SN, SA >::copy(), Aleph::copy_graph(), Aleph::Map_Matrix_Graph< GT, SA >::copy_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph(), Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::copy_painted_min_paths_tree(), Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::count_shown_arcs(), Aleph::Compute_Cut_Nodes< GT, SA >::cut_nodes(), Aleph::decompose_flow(), Aleph::eulerian_detail::degree(), Aleph::digraph_graphviz(), Aleph::in_arcs_detail::digraph_in_degree(), Aleph::dinic_maximum_flow(), Aleph::edge_connectivity(), Aleph::Digraph_Iterator< GT, Filter >::end(), Aleph::export_network_to_dimacs(), Aleph::export_network_to_dot(), Aleph::export_network_to_json(), Aleph::Test_Dirac_Condition< GT, SN, SA >::find_min_degree_vertex(), Aleph::find_path_depth_first(), Aleph::Find_Eulerian_Path< GT, SN, SA >::find_start_vertex(), Aleph::blossom_weighted_detail::mwmatching::impl::Problem_Data< WeightType >::for_adjacent_edges(), Aleph::for_each_arc(), Aleph::for_each_arc(), GraphCommon< GT, Node, Arc >::for_each_arc(), GraphCommon< GT, Node, Arc >::for_each_arc(), Aleph::Path< GT >::for_each_arc(), Aleph::for_each_arc(), Aleph::for_each_node(), GraphCommon< GT, Node, Arc >::for_each_node(), Aleph::Path< GT >::for_each_node(), Aleph::forall_arc(), Aleph::forall_arc(), Aleph::forall_node(), Aleph::generate_dot_file(), Aleph::k_shortest_paths_detail::generate_general_deviation_candidates(), Aleph::generate_graphpic(), Aleph::generate_graphviz(), Aleph::generate_graphviz(), Aleph::Find_Eulerian_Path< GT, SN, SA >::hierholzer_directed(), Aleph::Find_Eulerian_Path< GT, SN, SA >::hierholzer_undirected(), Aleph::hlpp_maximum_flow(), Aleph::hopcroft_karp_matching(), Aleph::in_arcs(), Aleph::in_degree(), Aleph::in_degree(), Aleph::in_nodes(), Aleph::in_pairs(), Aleph::min_mean_cycle_detail::incoming_lists(), Aleph::negative_cycles_detail::index_graph(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes(), Aleph::tree_decomposition_detail::Rooted_Tree_Topology< GT, SA >::index_nodes(), Aleph::tree_dp_detail::Tree_Topology< GT, SA >::index_nodes(), Aleph::net_detail::infinite_arc_preflow(), Aleph::IndexArc< GT, Tree, SA >::init(), Aleph::IndexNode< GT, Compare, Tree, SN >::init(), Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::init(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::init(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::init(), Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::init_from_graph(), Aleph::inter_copy_graph(), is_valid_topological_order(), Aleph::Compute_Cut_Nodes< GT, SA >::map_cut_graph(), Aleph::min_cut(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::min_spanning_tree(), Aleph::network_to_dot_string(), Aleph::network_to_json_string(), Aleph::graph_to_tree_detail::Frame< GT, Key, SA >::next_arc(), Aleph::Hopcroft_Karp_Frame< GT, SA >::next_arc(), Aleph::Build_Subgraph< GT, SA >::Map_Frame::next_arc(), Aleph::Build_Subgraph< GT, SA >::Arc_Frame::next_arc(), Aleph::Compute_Cut_Nodes< GT, SA >::Cut_Frame::next_arc(), Aleph::Compute_Cut_Nodes< GT, SA >::Arc_Frame::next_arc(), Aleph::Compute_Cut_Nodes< GT, SA >::Map_Frame::next_arc(), Aleph::Compute_Bridges< GT, SA >::Frame::next_arc(), Aleph::Dfs_Arc_Frame< It >::next_arc(), Aleph::Find_Depth_First_Spanning_Tree< GT, SA >::Frame::next_arc(), Aleph::Digraph_Iterator< GT, Filter >::next_ne(), Aleph::graph_to_tree_detail::Frame< GT, Key, SA >::next_target(), Aleph::Find_Depth_First_Spanning_Tree< GT, SA >::Frame::next_target(), Aleph::Build_Subgraph< GT, SA >::Arc_Frame::next_target(), Aleph::Dfs_Arc_Frame< It >::next_target(), Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::number_shown_nodes(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_list_graph(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::operate_all_arcs_list_graph(), Aleph::Invert_Digraph< GT, SA >::operator()(), Aleph::Operate_On_Nodes< GT, Operation, SN >::operator()(), Aleph::Operate_On_Arcs< GT, Operation, SA >::operator()(), Aleph::Operate_On_Arcs< GT, Operation, SA >::operator()(), Aleph::Test_Single_Graph< GT, SN, SA >::operator()(), Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::operator()(), Aleph::Operate_On_Nodes< GT, Operation, SN >::operator()(), Aleph::Operate_On_Arcs< GT, Operation, SA >::operator()(), Aleph::Operate_On_Arcs< GT, Operation, SA >::operator()(), Aleph::out_arcs(), Aleph::out_degree(), Aleph::out_nodes(), Aleph::out_pairs(), Aleph::Compute_Cut_Nodes< GT, SA >::paint_from_cut_node(), Aleph::Kruskal_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree(), Aleph::Kruskal_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree(), Aleph::Q_Topological_Sort< GT, Itor, SA >::perform(), Aleph::rank_graphviz(), Aleph::restore_flow_solution(), Aleph::net_detail::return_dust(), Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::save(), Aleph::save_flow_solution(), Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::save_in_text_mode(), Aleph::search_arc(), GraphCommon< GT, Node, Arc >::search_arc(), GraphCommon< GT, Node, Arc >::search_arc(), GraphCommon< GT, Node, Arc >::search_arc(), Aleph::search_directed_arc(), GraphCommon< GT, Node, Arc >::search_node(), Aleph::search_spanning_tree_arc(), Aleph::solve_circulation(), Aleph::solve_transshipment(), Aleph::ssp_init_potentials(), Aleph::ssp_shortest_path(), Aleph::successive_shortest_paths(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), Aleph::Test_For_Cycle< GT, SA >::test_cycle(), Aleph::Test_Eulerian< GT, SN, SA >::test_degree_only(), Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::test_digraph(), Aleph::Test_Dirac_Condition< GT, SN, SA >::test_digraph(), TEST_F(), TEST_F(), TEST_F(), Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::test_graph(), Aleph::Test_Dirac_Condition< GT, SN, SA >::test_graph(), Aleph::Test_Single_Graph< GT, SN, SA >::test_node(), Aleph::Test_For_Path< GT, SA >::test_path(), GraphCommon< GT, Node, Arc >::traverse_arcs(), GraphCommon< GT, Node, Arc >::traverse_arcs(), Aleph::traverse_arcs(), Aleph::in_arcs_detail::traverse_arcs_into(), Aleph::in_arcs_detail::traverse_digraph_arcs_into(), GraphCommon< GT, Node, Arc >::traverse_nodes(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::uninit(), Aleph::k_shortest_paths_detail::validate_non_negative_weights(), verify_bipartition(), verify_flow_conservation(), Aleph::vertex_connectivity(), and Aleph::df_tree_detail::Df_Low_Builder< GT, Node_Label, SA >::visit().

◆ prev()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::prev ( )
inline

Moves the iterator backward to the previous filtered element.

Moves backward in the sequence, skipping elements that don't pass the filter, until reaching the previous visible element or the beginning.

Exceptions
anythingthat the filter throws; the iterator stays then on the item on which it threw.
Note
Only where the base iterator moves back (goes_back): an iterator that goes only forward, as those of List_SGraph, has no prev(), so that the error is at the call.

Definition at line 506 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::backward().

Referenced by Aleph::Digraph_Iterator< GT, Filter >::prev(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), and TYPED_TEST().

◆ prev_ne()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::prev_ne ( )
inlinenoexcept

Moves the iterator backward, as prev() does.

Exceptions
anythingthat the filter throws, as prev(); prev_ne() is noexcept when the filter is.
Note
As prev(), only where the base iterator moves back.

Definition at line 514 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::backward().

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

◆ reset_first()

◆ reset_last()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::reset_last ( )
inline

Resets the iterator to the last filtered element.

Positions the iterator at the last element in the sequence that passes the filter predicate.

Note
Only where the base iterator goes to its last item and moves back (goes_to_last), which it needs to skip the hidden items.

Definition at line 535 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::goto_last_valid_item().

Referenced by Aleph::Digraph_Iterator< GT, Filter >::end(), Aleph::Digraph_Iterator< GT, Filter >::reset_last(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), and TYPED_TEST().

◆ set_cookie()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::set_cookie ( void *  __cookie)
inlinenoexcept

Sets the cookie pointer.

The cookie is a user-defined pointer for extensibility purposes, such as passing context data to the filter functor.

Parameters
__cookieThe new cookie value.

Definition at line 400 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::cookie.

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

◆ set_filter()

template<class Container , class It , class Show_Item >
void Aleph::Filter_Iterator< Container, It, Show_Item >::set_filter ( Show_Item  si)
inline

Sets a new filter functor.

This allows changing the filtering criterion after construction. After setting a new filter, you should call reset_first() or reset_last() to reposition the iterator according to the new filter.

Parameters
siThe new filter functor to use.
Note
Only for a filter that can be assigned: a lambda with captures, or a filter with a reference or a const member, cannot take another value.

Definition at line 389 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::show_item.

Referenced by TEST(), and TYPED_TEST().

Member Data Documentation

◆ container_ptr

template<class Container , class It , class Show_Item >
std::conditional_t<keeps_copy, Container, const Container *> Aleph::Filter_Iterator< Container, It, Show_Item >::container_ptr {}
private

◆ cookie

template<class Container , class It , class Show_Item >
void* Aleph::Filter_Iterator< Container, It, Show_Item >::cookie = nullptr
private

◆ goes_back

template<class Container , class It , class Show_Item >
constexpr bool Aleph::Filter_Iterator< Container, It, Show_Item >::goes_back = requires (It & i) { i.prev(); }
staticconstexpr

Whether the base iterator moves back, as prev() and prev_ne() need.

The iterators of a singly linked list, as those of the lists of arcs of List_SGraph, and of the sets of List_SGraph, go only forward.

Definition at line 307 of file filter_iterator.H.

◆ goes_to_last

template<class Container , class It , class Show_Item >
constexpr bool Aleph::Filter_Iterator< Container, It, Show_Item >::goes_to_last = requires (It & i) { i.reset_last(); i.prev(); }
staticconstexpr

Whether the base iterator goes to its last item and moves back, as reset_last() needs.

Definition at line 312 of file filter_iterator.H.

◆ keeps_copy

◆ show_item

◆ shows_ne

template<class Container , class It , class Show_Item >
constexpr bool Aleph::Filter_Iterator< Container, It, Show_Item >::shows_ne
staticconstexprprivate
Initial value:
=
PredicateWith<F, Args...>, and neither the call nor the conversion of its result to bool can throw.

Definition at line 175 of file filter_iterator.H.

◆ unchecked

template<class Container , class It , class Show_Item >
constexpr bool Aleph::Filter_Iterator< Container, It, Show_Item >::unchecked = AlephUncheckedIterator<It>
staticconstexprprivate

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