|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Iterator on the items of array. More...
#include <tpl_dynArray.H>
Public Types | |
| using | Set_Type = DynArray |
| using | aleph_random_access_iterator = Iterator |
| Opt-in marker for StlIterator random-access promotion. | |
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 |
| Check whether the iterator refers to an item. | |
| bool | is_last () const noexcept |
| Check whether the current item is the last item. | |
| T & | get_curr_ne () const noexcept |
| Return the current link guaranteeing no exception. Be careful. | |
| T & | get_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 () |
| Advance one position, from the last item to the end if needed. | |
| 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 | |
| DynArray * | array_ptr = nullptr |
| long | curr_idx = 0 |
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 1381 of file tpl_dynArray.H.
Opt-in marker for StlIterator random-access promotion.
It is the iterator's own type on purpose: derived iterators that reuse this class as a base (e.g. DynArrayHeap::Iterator, which redefines get_pos() with an offset) do NOT inherit the promotion, because their own type differs from this marker. This keeps the promotion fail-safe.
Definition at line 1395 of file tpl_dynArray.H.
Definition at line 1388 of file tpl_dynArray.H.
|
defaultnoexcept |
Default constructor creates an "end" iterator.
|
inlinenoexcept |
Initializes an iterator on array
Definition at line 1401 of file tpl_dynArray.H.
|
inlinenoexcept |
Put the iterator in the end state.
Definition at line 1499 of file tpl_dynArray.H.
References Aleph::DynArray< T >::Iterator::array_ptr, Aleph::DynArray< T >::Iterator::curr_idx, and Aleph::DynArray< T >::size().
|
inline |
Return the current item.
| std::underflow_error | if positioned before the first item. |
| std::overflow_error | if singular or at or past the end. |
Definition at line 1441 of file tpl_dynArray.H.
References ah_overflow_error_if, ah_underflow_error_if, Aleph::DynArray< T >::Iterator::array_ptr, Aleph::blossom_maximum_cardinality_matching(), Aleph::DynArray< T >::Iterator::curr_idx, Aleph::DynArray< T >::Iterator::get_curr_ne(), and Aleph::DynArray< T >::size().
Referenced by main().
|
inlinenoexcept |
Return the current link guaranteeing no exception. Be careful.
Definition at line 1430 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().
|
inlinenoexcept |
Return the ordinal position of current item.
Definition at line 1451 of file tpl_dynArray.H.
References Aleph::DynArray< T >::Iterator::curr_idx.
|
inlinenoexcept |
Check whether the iterator refers to an item.
A default-constructed (singular) iterator behaves as an empty sequence.
true if there is a current item; false for singular, empty, or out-of-range iterators. Definition at line 1412 of file tpl_dynArray.H.
References FunctionalMethods< DynArray< T >, T >::and, Aleph::DynArray< T >::Iterator::array_ptr, Aleph::DynArray< T >::Iterator::curr_idx, and Aleph::DynArray< T >::size().
Referenced by Aleph::DynArray< T >::Iterator::is_last(), and main().
|
inlinenoexcept |
Check whether the current item is the last item.
true only when a current item exists and it is the last; false for singular or empty iterators. Definition at line 1423 of file tpl_dynArray.H.
References FunctionalMethods< DynArray< T >, T >::and, Aleph::DynArray< T >::Iterator::array_ptr, Aleph::DynArray< T >::Iterator::curr_idx, Aleph::DynArray< T >::Iterator::has_curr(), and Aleph::DynArray< T >::size().
|
inline |
Advance one position, from the last item to the end if needed.
| std::overflow_error | if the iterator is singular or already at or past the end. |
Definition at line 1468 of file tpl_dynArray.H.
References ah_overflow_error_if, FunctionalMethods< DynArray< T >, T >::and, Aleph::DynArray< T >::Iterator::array_ptr, Aleph::blossom_maximum_cardinality_matching(), Aleph::DynArray< T >::Iterator::curr_idx, Aleph::DynArray< T >::Iterator::next_ne(), and Aleph::DynArray< T >::size().
|
inlinenoexcept |
Move the iterator one position forward guaranteeing no exception.
Be careful.
Definition at line 1458 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().
|
inline |
Move the current a position backward.
Throw underflow_error if current is the first item
Definition at line 1486 of file tpl_dynArray.H.
References ah_underflow_error_if, Aleph::DynArray< T >::Iterator::curr_idx, and Aleph::DynArray< T >::Iterator::prev_ne().
Referenced by main().
|
inlinenoexcept |
exception. Be careful.
Definition at line 1479 of file tpl_dynArray.H.
References Aleph::DynArray< T >::Iterator::curr_idx.
Referenced by Aleph::DynArray< T >::Iterator::prev().
|
inlinenoexcept |
Reset the iterator to the first item.
Definition at line 1505 of file tpl_dynArray.H.
References Aleph::DynArray< T >::Iterator::curr_idx.
|
inlinenoexcept |
Reset the iterator to the last item.
Definition at line 1493 of file tpl_dynArray.H.
References Aleph::DynArray< T >::Iterator::array_ptr, Aleph::DynArray< T >::Iterator::curr_idx, and Aleph::DynArray< T >::size().
Referenced by main().
Definition at line 1510 of file tpl_dynArray.H.
References Aleph::DynArray< T >::Iterator::curr_idx.
Referenced by Aleph::DynArray< T >::get_it().
|
protected |
Definition at line 1384 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::Iterator::end(), Aleph::DynArray< T >::Iterator::get_curr(), Aleph::DynArray< T >::Iterator::get_curr_ne(), Aleph::DynArray< T >::Iterator::has_curr(), Aleph::DynArrayHeap< T, Compare >::Iterator::has_curr(), Aleph::DynArray< T >::Iterator::is_last(), Aleph::DynArray< T >::Iterator::next(), and Aleph::DynArray< T >::Iterator::reset_last().
|
protected |
Definition at line 1385 of file tpl_dynArray.H.
Referenced by Aleph::DynArray< T >::Iterator::end(), Aleph::DynArray< T >::Iterator::get_curr(), Aleph::DynArray< T >::Iterator::get_curr_ne(), Aleph::DynArray< T >::Iterator::get_pos(), Aleph::DynArray< T >::Iterator::has_curr(), Aleph::DynArrayHeap< T, Compare >::Iterator::has_curr(), Aleph::DynArray< T >::Iterator::is_last(), Aleph::DynArray< T >::Iterator::next(), Aleph::DynArray< T >::Iterator::next_ne(), Aleph::DynArray< T >::Iterator::prev(), Aleph::DynArray< T >::Iterator::prev_ne(), Aleph::DynArray< T >::Iterator::reset_first(), Aleph::DynArray< T >::Iterator::reset_last(), and Aleph::DynArray< T >::Iterator::set_pos().