Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::HTList::Iterator Class Reference

#include <htlist.H>

Inheritance diagram for Aleph::HTList::Iterator:
[legend]
Collaboration diagram for Aleph::HTList::Iterator:
[legend]

Public Member Functions

 Iterator () noexcept=default
 
 Iterator (const HTList &list) noexcept
 Initialize iterator on at the first item of list
 
void reset () noexcept
 Reset the iterator at the first item.
 
long get_pos () const noexcept
 
void reset_first () noexcept
 See reset().
 
void reset_last ()
 It has O(n) of performance.
 
void end () noexcept
 Set the iterator to its end position, which has not.
 
 Iterator (const Iterator &)=default
 
Iterator & operator= (const Iterator &it) noexcept
 
bool has_curr () const noexcept
 
bool is_last () const noexcept
 
bool is_in_first () const noexcept
 Return true if the iterator is positioned on the first item.
 
bool is_in_last () const noexcept
 Return true if the iterator is positioned on the last item.
 
Slinknc * get_curr () const
 
Slinknc * get_curr_ne () const noexcept
 Return the current link guaranteeing no exception. Be careful.
 
void next_ne () noexcept
 Move the iterator one position forward guaranteeing no exception.
 
void next ()
 
Slinknc * del_ne () noexcept
 Remove the current item and move the iterator one position forward, without checking that there is a current item.
 
Slinknc * del ()
 

Protected Member Functions

HTList * get_list_ptr () const noexcept
 The list of the iterator, for the iterators of the derived lists.
 

Private Attributes

HTList * lptr = nullptr
 
Slinknc * curr = nullptr
 
Slinknc * prev = nullptr
 
long pos = 0
 

Detailed Description

Iterator on HTList.

Definition at line 891 of file htlist.H.

Constructor & Destructor Documentation

◆ Iterator() [1/3]

Aleph::HTList::Iterator::Iterator ( )
defaultnoexcept

◆ Iterator() [2/3]

Aleph::HTList::Iterator::Iterator ( const HTList &  list)
inlinenoexcept

Initialize iterator on at the first item of list

list

Definition at line 912 of file htlist.H.

◆ Iterator() [3/3]

Aleph::HTList::Iterator::Iterator ( const Iterator &  )
default

Member Function Documentation

◆ del()

Slinknc * Aleph::HTList::Iterator::del ( )
inline
   Remove the current item.

del() removes the current item of iterator and advaces it a position forward.

Returns
a valid pointer to the removed item
Exceptions
overflow_errorif iterator has not current item

Definition at line 1097 of file htlist.H.

References ah_overflow_error_if, del_ne(), and has_curr().

Referenced by Aleph::DynList< T >::Iterator::del().

◆ del_ne()

Slinknc * Aleph::HTList::Iterator::del_ne ( )
inlinenoexcept

Remove the current item and move the iterator one position forward, without checking that there is a current item.

It checks nothing, as the _ne variants promise: the check of remove_first() throws, and inside noexcept that would end the program.

Precondition
has_curr(), which only an assert checks: without a current item, the removal reads through a null node.
Returns
the removed node, which the caller takes

Definition at line 1057 of file htlist.H.

References curr, has_curr(), Aleph::HTList::head, lptr, NEXT, prev, Aleph::HTList::remove_first_ne(), Aleph::Slinknc::reset(), and Aleph::HTList::tail.

Referenced by del(), Aleph::DynList< T >::Iterator::del_ne(), TEST(), and TEST_F().

◆ end()

void Aleph::HTList::Iterator::end ( )
inlinenoexcept

Set the iterator to its end position, which has not.

Definition at line 953 of file htlist.H.

References curr.

Referenced by TEST().

◆ get_curr()

Slinknc * Aleph::HTList::Iterator::get_curr ( ) const
inline

◆ get_curr_ne()

Slinknc * Aleph::HTList::Iterator::get_curr_ne ( ) const
inlinenoexcept

Return the current link guaranteeing no exception. Be careful.

Definition at line 1005 of file htlist.H.

References curr.

Referenced by Aleph::Filter_Iterator< Container, It, Show_Item >::base_curr(), Aleph::Filter_Iterator< Container, It, Show_Item >::forward(), Aleph::DynList< T >::Iterator::get_curr_ne(), and TEST_F().

◆ get_list_ptr()

HTList * Aleph::HTList::Iterator::get_list_ptr ( ) const
inlineprotectednoexcept

The list of the iterator, for the iterators of the derived lists.

Definition at line 901 of file htlist.H.

References lptr.

Referenced by Aleph::DynList< T >::Iterator::list_ptr().

◆ get_pos()

long Aleph::HTList::Iterator::get_pos ( ) const
inlinenoexcept

Definition at line 925 of file htlist.H.

References pos.

Referenced by TEST().

◆ has_curr()

bool Aleph::HTList::Iterator::has_curr ( ) const
inlinenoexcept

Definition at line 969 of file htlist.H.

References curr.

Referenced by Aleph::Filter_Iterator< Container, It, Show_Item >::backward(), Aleph::compute_min_cut(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::connected_components(), count_elements(), Aleph::sort_utils_detail::counting_sort_impl(), del(), Aleph::DynList< T >::Iterator::del(), del_ne(), GraphCommon< GT, Node, Arc >::for_each_arc(), GraphCommon< GT, Node, Arc >::for_each_arc(), GraphCommon< GT, Node, Arc >::for_each_node(), Aleph::Filter_Iterator< Container, It, Show_Item >::forward(), Aleph::DynList< T >::get(), Aleph::Filter_Iterator< Container, It, Show_Item >::goto_first_valid_item(), Aleph::Filter_Iterator< Container, It, Show_Item >::goto_last_valid_item(), Aleph::insert_sorted(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::join_through_a_path(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_the_complement(), main(), main(), next(), Aleph::Dfs_Arc_Frame< It >::next_target(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::operator()(), print(), Aleph::DynList< T >::remove(), Aleph::DynList< T >::remove_ne(), GraphCommon< GT, Node, Arc >::search_arc(), GraphCommon< GT, Node, Arc >::search_arc(), GraphCommon< GT, Node, Arc >::search_arc(), Aleph::search_extreme(), GraphCommon< GT, Node, Arc >::search_node(), Aleph::sequential_search(), Aleph::HTList::size(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_DynSet(), test_DynSetLinHash(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), GraphCommon< GT, Node, Arc >::traverse_arcs(), GraphCommon< GT, Node, Arc >::traverse_arcs(), GraphCommon< GT, Node, Arc >::traverse_nodes(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ is_in_first()

bool Aleph::HTList::Iterator::is_in_first ( ) const
inlinenoexcept

Return true if the iterator is positioned on the first item.

Definition at line 980 of file htlist.H.

References curr, Aleph::HTList::head, Aleph::HTList::is_empty(), and lptr.

Referenced by TEST().

◆ is_in_last()

bool Aleph::HTList::Iterator::is_in_last ( ) const
inlinenoexcept

Return true if the iterator is positioned on the last item.

Definition at line 986 of file htlist.H.

References is_last().

Referenced by TEST().

◆ is_last()

bool Aleph::HTList::Iterator::is_last ( ) const
inlinenoexcept

Definition at line 974 of file htlist.H.

References curr, Aleph::HTList::is_empty(), lptr, and Aleph::HTList::tail.

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

◆ next()

void Aleph::HTList::Iterator::next ( )
inline
Move the iterator one item forward. Throw overflow_error if

iterator has not current item

Definition at line 1040 of file htlist.H.

References ah_overflow_error_if, has_curr(), and next_ne().

Referenced by Aleph::insert_sorted(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ next_ne()

◆ operator=()

Iterator & Aleph::HTList::Iterator::operator= ( const Iterator &  it)
inlinenoexcept

Definition at line 960 of file htlist.H.

References curr, lptr, pos, and prev.

◆ reset()

void Aleph::HTList::Iterator::reset ( )
inlinenoexcept

Reset the iterator at the first item.

Definition at line 919 of file htlist.H.

References curr, Aleph::HTList::head, lptr, pos, and prev.

Referenced by reset_first(), reset_last(), and TEST_F().

◆ reset_first()

void Aleph::HTList::Iterator::reset_first ( )
inlinenoexcept

See reset().

Definition at line 931 of file htlist.H.

References reset().

Referenced by TEST(), and TEST_F().

◆ reset_last()

void Aleph::HTList::Iterator::reset_last ( )
inline

It has O(n) of performance.

Definition at line 937 of file htlist.H.

References curr, Aleph::HTList::is_empty(), lptr, NEXT, pos, prev, and reset().

Referenced by TEST().

Member Data Documentation

◆ curr

Slinknc* Aleph::HTList::Iterator::curr = nullptr
private

◆ lptr

HTList* Aleph::HTList::Iterator::lptr = nullptr
private

Definition at line 893 of file htlist.H.

Referenced by del_ne(), get_list_ptr(), is_in_first(), is_last(), next_ne(), operator=(), reset(), and reset_last().

◆ pos

long Aleph::HTList::Iterator::pos = 0
private

Definition at line 897 of file htlist.H.

Referenced by get_pos(), next_ne(), operator=(), reset(), and reset_last().

◆ prev

Slinknc* Aleph::HTList::Iterator::prev = nullptr
private

Definition at line 895 of file htlist.H.

Referenced by del_ne(), next_ne(), operator=(), reset(), and reset_last().


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