Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::DynArray< T >::Iterator Class Reference

Iterator on the items of array. More...

#include <tpl_dynArray.H>

Inheritance diagram for Aleph::DynArray< T >::Iterator:
[legend]
Collaboration diagram for Aleph::DynArray< T >::Iterator:
[legend]

Public Types

using Set_Type = DynArray
 

Public Member Functions

 Iterator () noexcept=default
 Default constructor creates an "end" iterator.
 
 Iterator (const DynArray &array) noexcept
 Initializes an iterator on array
 
bool has_curr () const noexcept
 Return true if there is current item.
 
bool is_last () const noexcept
 
Tget_curr_ne () const noexcept
 Return the current link guaranteeing no exception. Be careful.
 
Tget_curr () const
 Return the current item.
 
long get_pos () const noexcept
 Return the ordinal position of current item.
 
void next_ne () noexcept
 Move the iterator one position forward guaranteeing no exception.
 
void next ()
 Move the current a position forward.
 
void prev_ne () noexcept
 exception. Be careful.
 
void prev ()
 Move the current a position backward.
 
void reset_last () noexcept
 Reset the iterator to the last item.
 
void end () noexcept
 Put the iterator in the end state.
 
void reset_first () noexcept
 Reset the iterator to the first item.
 
void set_pos (const long pos) noexcept
 

Protected Attributes

DynArrayarray_ptr = nullptr
 
long curr_idx = 0
 

Detailed Description

template<typename T>
class Aleph::DynArray< T >::Iterator

Iterator on the items of array.

The visit order is from the lower index 0 to current dimension minus one.

It is assumed that all the entries between 0 and current dimension have been allocated.

Definition at line 1331 of file tpl_dynArray.H.

Member Typedef Documentation

◆ Set_Type

template<typename T >
using Aleph::DynArray< T >::Iterator::Set_Type = DynArray

Definition at line 1338 of file tpl_dynArray.H.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<typename T >
Aleph::DynArray< T >::Iterator::Iterator ( )
defaultnoexcept

Default constructor creates an "end" iterator.

◆ Iterator() [2/2]

template<typename T >
Aleph::DynArray< T >::Iterator::Iterator ( const DynArray array)
inlinenoexcept

Initializes an iterator on array

Definition at line 1344 of file tpl_dynArray.H.

Member Function Documentation

◆ end()

template<typename T >
void Aleph::DynArray< T >::Iterator::end ( )
inlinenoexcept

Put the iterator in the end state.

Definition at line 1402 of file tpl_dynArray.H.

References Aleph::DynArray< T >::Iterator::array_ptr, Aleph::DynArray< T >::Iterator::curr_idx, and Aleph::DynArray< T >::size().

◆ get_curr()

template<typename T >
T & Aleph::DynArray< T >::Iterator::get_curr ( ) const
inline

Return the current item.

Exceptions
overflow_errorif there is no current

Definition at line 1365 of file tpl_dynArray.H.

References ah_overflow_error_if, Aleph::DynArray< T >::Iterator::array_ptr, Aleph::DynArray< T >::Iterator::curr_idx, Aleph::DynArray< T >::Iterator::get_curr_ne(), and Aleph::DynArray< T >::size().

◆ get_curr_ne()

template<typename T >
T & Aleph::DynArray< T >::Iterator::get_curr_ne ( ) const
inlinenoexcept

Return the current link guaranteeing no exception. Be careful.

Definition at line 1359 of file tpl_dynArray.H.

References Aleph::DynArray< T >::access(), Aleph::DynArray< T >::Iterator::array_ptr, and Aleph::DynArray< T >::Iterator::curr_idx.

Referenced by Aleph::DynArray< T >::Iterator::get_curr().

◆ get_pos()

template<typename T >
long Aleph::DynArray< T >::Iterator::get_pos ( ) const
inlinenoexcept

Return the ordinal position of current item.

Definition at line 1372 of file tpl_dynArray.H.

References Aleph::DynArray< T >::Iterator::curr_idx.

◆ has_curr()

template<typename T >
bool Aleph::DynArray< T >::Iterator::has_curr ( ) const
inlinenoexcept

◆ is_last()

template<typename T >
bool Aleph::DynArray< T >::Iterator::is_last ( ) const
inlinenoexcept

◆ next()

template<typename T >
void Aleph::DynArray< T >::Iterator::next ( )
inline

Move the current a position forward.

Throw overflow_error if current is the last item

Definition at line 1380 of file tpl_dynArray.H.

References ah_overflow_error_if, Aleph::DynArray< T >::Iterator::array_ptr, Aleph::DynArray< T >::Iterator::curr_idx, Aleph::DynArray< T >::Iterator::next_ne(), and Aleph::DynArray< T >::size().

◆ next_ne()

template<typename T >
void Aleph::DynArray< T >::Iterator::next_ne ( )
inlinenoexcept

Move the iterator one position forward guaranteeing no exception.

Be careful.

Definition at line 1376 of file tpl_dynArray.H.

References Aleph::DynArray< T >::Iterator::curr_idx.

Referenced by Aleph::DynArrayHeap< T, Compare >::Iterator::Iterator(), and Aleph::DynArray< T >::Iterator::next().

◆ prev()

template<typename T >
void Aleph::DynArray< T >::Iterator::prev ( )
inline

Move the current a position backward.

Throw underflow_error if current is the first item

Definition at line 1392 of file tpl_dynArray.H.

References ah_underflow_error_if, Aleph::DynArray< T >::Iterator::curr_idx, and Aleph::DynArray< T >::Iterator::prev_ne().

◆ prev_ne()

template<typename T >
void Aleph::DynArray< T >::Iterator::prev_ne ( )
inlinenoexcept

exception. Be careful.

Definition at line 1388 of file tpl_dynArray.H.

References Aleph::DynArray< T >::Iterator::curr_idx.

Referenced by Aleph::DynArray< T >::Iterator::prev().

◆ reset_first()

template<typename T >
void Aleph::DynArray< T >::Iterator::reset_first ( )
inlinenoexcept

Reset the iterator to the first item.

Definition at line 1405 of file tpl_dynArray.H.

References Aleph::DynArray< T >::Iterator::curr_idx.

◆ reset_last()

template<typename T >
void Aleph::DynArray< T >::Iterator::reset_last ( )
inlinenoexcept

Reset the iterator to the last item.

Definition at line 1399 of file tpl_dynArray.H.

References Aleph::DynArray< T >::Iterator::array_ptr, Aleph::DynArray< T >::Iterator::curr_idx, and Aleph::DynArray< T >::size().

◆ set_pos()

template<typename T >
void Aleph::DynArray< T >::Iterator::set_pos ( const long  pos)
inlinenoexcept

Definition at line 1407 of file tpl_dynArray.H.

References Aleph::DynArray< T >::Iterator::curr_idx.

Referenced by Aleph::DynArray< T >::get_it().

Member Data Documentation

◆ array_ptr

◆ curr_idx


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