Aleph-w 3.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 Containerget_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_Itemget_filter () noexcept
 Returns a reference to the filter functor.
 
const Show_Itemget_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.
 
voidget_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 (const Container &c, void *__cookie, Show_Item si=Show_Item())
 Constructs a filter iterator with a cookie.
 
void next ()
 Advances the iterator to the next filtered element.
 
void next_ne () noexcept
 Advances the iterator to the next filtered element (noexcept version).
 
void prev ()
 Moves the iterator backward to the previous filtered element.
 
void prev_ne () noexcept
 Moves the iterator backward (noexcept version).
 
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.
 

Private Member Functions

void goto_first_valid_item ()
 Advance to the first element that passes the filter.
 
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.
 

Private Attributes

Show_Item show_item
 
const Containercontainer_ptr = nullptr
 
voidcookie = nullptr
 User-defined pointer for extensibility (e.g., passing context data to filter)
 

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
DynList< T > maps(const C &c, Op op)
Classic map operation.
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
The iterator catches std::overflow_error and std::underflow_error internally to handle boundary conditions gracefully. Other exceptions from the filter functor will propagate to the caller.
Author
Leandro Rabindranath León

Definition at line 123 of file filter_iterator.H.

Member Typedef Documentation

◆ Container_Type

The type of container being iterated.

Definition at line 225 of file filter_iterator.H.

◆ Filter_Type

The type of the filter functor.

Definition at line 228 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 219 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 222 of file filter_iterator.H.

Constructor & Destructor Documentation

◆ Filter_Iterator() [1/3]

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 314 of file filter_iterator.H.

◆ Filter_Iterator() [2/3]

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.

Definition at line 329 of file filter_iterator.H.

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

◆ Filter_Iterator() [3/3]

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 345 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::cookie, and Aleph::maps().

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.

Catches std::underflow_error internally to handle beginning-of-sequence gracefully without propagating the exception.

Definition at line 205 of file filter_iterator.H.

References Aleph::maps(), 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().

◆ 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 426 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 443 of file filter_iterator.H.

References Aleph::has_curr(), Aleph::maps(), 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 482 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(), and 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:1714
Generic filter iterator wrapper.

Definition at line 464 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.

Catches std::overflow_error internally to handle end-of-sequence gracefully without propagating the exception.

Definition at line 164 of file filter_iterator.H.

References Aleph::maps(), and Aleph::Filter_Iterator< Container, It, Show_Item >::show_item.

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

◆ 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 236 of file filter_iterator.H.

References ah_domain_error_if, and Aleph::Filter_Iterator< Container, It, Show_Item >::container_ptr.

Referenced by TEST(), and 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 301 of file filter_iterator.H.

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

Referenced by TEST(), TEST(), TEST(), and 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 276 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 270 of file filter_iterator.H.

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

Referenced by 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 260 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 254 of file filter_iterator.H.

Referenced by TEST().

◆ goto_first_valid_item()

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

Advance to the first element that passes the filter.

Starting from the current position, advances the iterator until finding an element that satisfies the filter predicate, or until reaching the end of the sequence.

Catches std::overflow_error internally to handle end-of-sequence gracefully without propagating the exception.

Definition at line 141 of file filter_iterator.H.

References Aleph::maps(), and Aleph::Filter_Iterator< Container, It, Show_Item >::show_item.

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

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

Catches std::underflow_error internally to handle beginning-of-sequence gracefully without propagating the exception.

Definition at line 185 of file filter_iterator.H.

References Aleph::maps(), 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 246 of file filter_iterator.H.

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

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

◆ 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 (noexcept version).

This is the exception-safe version of next(). All exceptions are silently caught and the iterator remains in a valid state.

Note
This method is noexcept and will never throw.

Definition at line 366 of file filter_iterator.H.

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

Referenced by Aleph::Depth_First_Traversal< GT, Operation, SA >::__dft(), Aleph::__graph_to_tree_node(), Aleph::Test_Eulerian< GT, SN, SA >::analyze_digraph(), Aleph::Test_Eulerian< GT, SN, SA >::analyze_graph(), Aleph::arcs(), Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::are_adjacent(), Aleph::Breadth_First_Traversal< GT, Operation, SA >::bft(), 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::Network_Simplex< Net >::build_spanning_tree(), Aleph::Build_Subgraph< GT, SA >::build_subgraph(), Aleph::Find_Breadth_First_Spanning_Tree< GT, SA >::build_tree(), Aleph::capacity_scaling_maximum_flow(), Aleph::compute_bipartite(), Aleph::compute_bipartite_all_components(), Aleph::compute_flow_statistics(), Aleph::compute_maximum_cardinality_bipartite_matching(), Aleph::compute_min_cut(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Copy_Graph< GT, SN, SA >::copy(), Aleph::Compute_Cut_Nodes< GT, SA >::cut_nodes(), Aleph::decompose_flow(), Aleph::digraph_graphviz(), Aleph::dinic_maximum_flow(), Aleph::edge_connectivity(), 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_Eulerian_Path< GT, SN, SA >::find_start_vertex(), Aleph::for_each_arc(), Aleph::for_each_arc(), Aleph::for_each_node(), Aleph::forall_arc(), Aleph::forall_arc(), Aleph::forall_node(), Aleph::generate_dot_file(), Aleph::generate_graphpic(), Aleph::generate_graphviz(), Aleph::generate_graphviz(), Aleph::Graph_To_Tree_Node< GT, Key, Convert, SA >::graph_to_tree(), Aleph::Test_Hamiltonian_Sufficiency< GT, SN, SA >::has_arc(), 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_dfs(), Aleph::hopcroft_karp_matching(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::init(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::init(), Aleph::IndexArc< GT, Tree, SA >::init(), Aleph::IndexNode< GT, Compare, Tree, SN >::init(), Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::init_from_graph(), Aleph::Is_Graph_Acyclique< GT, SA >::is_acyclique(), Aleph::Test_Eulerian< GT, SN, SA >::is_connected(), Aleph::Test_Eulerian< GT, SN, SA >::is_strongly_connected(), is_valid_topological_order(), Aleph::Compute_Cut_Nodes< GT, SA >::map_cut_graph(), Aleph::Compute_Cut_Nodes< GT, SA >::map_subgraph(), 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::Digraph_Iterator< GT, Filter >::next_ne(), 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::Compute_Cut_Nodes< GT, SA >::paint_from_cut_node(), 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::Compute_Cut_Nodes< GT, SA >::paint_subgraph(), Aleph::Q_Topological_Sort< GT, Itor, SA >::perform(), Aleph::rank_graphviz(), Aleph::restore_flow_solution(), 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_directed_arc(), 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(), Aleph::Test_For_Cycle< GT, SA >::test_cycle(), 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(), 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(), Aleph::Test_For_Path< GT, SA >::test_path(), verify_bipartition(), verify_flow_conservation(), and Aleph::vertex_connectivity().

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

Definition at line 380 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(), and 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 (noexcept version).

This is the exception-safe version of prev(). All exceptions are silently caught and the iterator remains in a valid state.

Note
This method is noexcept and will never throw.

Definition at line 389 of file filter_iterator.H.

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

Referenced by 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.

Definition at line 414 of file filter_iterator.H.

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

Referenced by Aleph::Digraph_Iterator< GT, Filter >::reset_last(), TEST(), TEST(), TEST(), TEST(), and 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 295 of file filter_iterator.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::cookie, and Aleph::maps().

Referenced by TEST(), TEST(), and 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.

Definition at line 286 of file filter_iterator.H.

References Aleph::maps(), and Aleph::Filter_Iterator< Container, It, Show_Item >::show_item.

Referenced by TEST().

Member Data Documentation

◆ container_ptr

◆ cookie

◆ show_item


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