|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Iterator on the items of the heap, in the order of its array, which is not the sorted one. More...
#include <tpl_dynArrayHeap.H>
Public Types | |
| using | Set_Type = DynArrayHeap |
| The container that it goes through. | |
| using | Item_Type = T |
| The type of the items. | |
Public Member Functions | |
| Iterator () noexcept=default | |
| An iterator without a heap, which has no items. | |
| Iterator (const DynArrayHeap &h) noexcept | |
| Iterator on the first item of a heap, in the order of its array. | |
| bool | has_curr () const noexcept |
| Return true if the iterator is on an item. | |
| bool | is_last () const noexcept |
| Return true if the iterator is on the last item. | |
| const T & | get_curr_ne () const noexcept |
| The current item, without checking that there is one. | |
| const T & | get_curr () const |
| The current item, read-only: the heap order must not be broken. | |
| long | get_pos () const noexcept |
| The position of the current item among those of the heap, from 0. | |
| void | set_pos (const long pos) noexcept |
Put the iterator on the position pos, without checking it. | |
| void | next_ne () noexcept |
| Move one position forward, without checking. | |
| void | next () |
| Move one position forward, from the last item to the end too. | |
| void | prev_ne () noexcept |
| Move one position backward, without checking. | |
| void | prev () |
| Move one position backward, from the first item to before it too. | |
| void | reset_first () noexcept |
| Put the iterator on the first item. | |
| void | reset_last () noexcept |
| Put the iterator on the last item. | |
| void | end () noexcept |
| Put the iterator at the end, after the last item. | |
Private Member Functions | |
| long | items () const noexcept |
| The number of items of the heap; none without a heap. | |
Private Attributes | |
| const DynArrayHeap * | heap_ptr = nullptr |
| The heap; none in an iterator built without one. | |
| long | curr_idx = 0 |
| The position of the current item, from 0. | |
Iterator on the items of the heap, in the order of its array, which is not the sorted one.
The items are read-only: the heap order must not be broken. It goes through the items that the heap has, the entries 1 to size() of its array, whatever the array has beyond them, as traverse() does. An insertion or an extraction moves the items, so that the positions that it gave are no longer theirs.
Definition at line 576 of file tpl_dynArrayHeap.H.
| using Aleph::DynArrayHeap< T, Compare >::Iterator::Item_Type = T |
The type of the items.
Definition at line 589 of file tpl_dynArrayHeap.H.
| using Aleph::DynArrayHeap< T, Compare >::Iterator::Set_Type = DynArrayHeap |
The container that it goes through.
Definition at line 588 of file tpl_dynArrayHeap.H.
|
defaultnoexcept |
An iterator without a heap, which has no items.
|
inlinenoexcept |
Iterator on the first item of a heap, in the order of its array.
| [in] | h | the heap. |
Definition at line 598 of file tpl_dynArrayHeap.H.
|
inlinenoexcept |
Put the iterator at the end, after the last item.
Definition at line 668 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx, and Aleph::DynArrayHeap< T, Compare >::Iterator::items().
Referenced by TEST().
|
inline |
The current item, read-only: the heap order must not be broken.
| std::underflow_error | if the iterator is before the first item. |
| std::overflow_error | if it is after the last item, or has no heap. |
Definition at line 619 of file tpl_dynArrayHeap.H.
References ah_overflow_error_if, ah_underflow_error_if, Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx, Aleph::DynArrayHeap< T, Compare >::Iterator::get_curr_ne(), and Aleph::DynArrayHeap< T, Compare >::Iterator::items().
Referenced by TEST().
|
inlinenoexcept |
The current item, without checking that there is one.
Definition at line 607 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::array, Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx, and Aleph::DynArrayHeap< T, Compare >::Iterator::heap_ptr.
Referenced by Aleph::DynArrayHeap< T, Compare >::Iterator::get_curr().
|
inlinenoexcept |
The position of the current item among those of the heap, from 0.
Definition at line 627 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx.
|
inlinenoexcept |
Return true if the iterator is on an item.
Definition at line 601 of file tpl_dynArrayHeap.H.
References FunctionalMethods< Container, T >::and, Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx, and Aleph::DynArrayHeap< T, Compare >::Iterator::items().
Referenced by Aleph::DynArrayHeap< T, Compare >::Iterator::is_last(), TEST(), and TEST().
|
inlinenoexcept |
Return true if the iterator is on the last item.
Definition at line 604 of file tpl_dynArrayHeap.H.
References FunctionalMethods< Container, T >::and, Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx, Aleph::DynArrayHeap< T, Compare >::Iterator::has_curr(), and Aleph::DynArrayHeap< T, Compare >::Iterator::items().
Referenced by TEST().
|
inlineprivatenoexcept |
The number of items of the heap; none without a heap.
Definition at line 582 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::Iterator::heap_ptr, and Aleph::DynArrayHeap< T, Compare >::num_items.
Referenced by Aleph::DynArrayHeap< T, Compare >::Iterator::end(), Aleph::DynArrayHeap< T, Compare >::Iterator::get_curr(), Aleph::DynArrayHeap< T, Compare >::Iterator::has_curr(), Aleph::DynArrayHeap< T, Compare >::Iterator::is_last(), Aleph::DynArrayHeap< T, Compare >::Iterator::next(), and Aleph::DynArrayHeap< T, Compare >::Iterator::reset_last().
|
inline |
Move one position forward, from the last item to the end too.
| std::overflow_error | if the iterator is at the end, or has no heap. |
Definition at line 640 of file tpl_dynArrayHeap.H.
References ah_overflow_error_if, Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx, Aleph::DynArrayHeap< T, Compare >::Iterator::heap_ptr, Aleph::DynArrayHeap< T, Compare >::Iterator::items(), and Aleph::DynArrayHeap< T, Compare >::Iterator::next_ne().
Referenced by TEST().
|
inlinenoexcept |
Move one position forward, without checking.
Definition at line 633 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx.
Referenced by Aleph::DynArrayHeap< T, Compare >::Iterator::next().
|
inline |
Move one position backward, from the first item to before it too.
| std::underflow_error | if the iterator is before the first item. |
Definition at line 655 of file tpl_dynArrayHeap.H.
References ah_underflow_error_if, Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx, and Aleph::DynArrayHeap< T, Compare >::Iterator::prev_ne().
|
inlinenoexcept |
Move one position backward, without checking.
Definition at line 648 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx.
Referenced by Aleph::DynArrayHeap< T, Compare >::Iterator::prev().
|
inlinenoexcept |
Put the iterator on the first item.
Definition at line 662 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx.
|
inlinenoexcept |
Put the iterator on the last item.
Definition at line 665 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx, and Aleph::DynArrayHeap< T, Compare >::Iterator::items().
Referenced by TEST().
|
inlinenoexcept |
Put the iterator on the position pos, without checking it.
Definition at line 630 of file tpl_dynArrayHeap.H.
References Aleph::DynArrayHeap< T, Compare >::Iterator::curr_idx.
|
private |
The position of the current item, from 0.
Definition at line 579 of file tpl_dynArrayHeap.H.
Referenced by Aleph::DynArrayHeap< T, Compare >::Iterator::end(), Aleph::DynArrayHeap< T, Compare >::Iterator::get_curr(), Aleph::DynArrayHeap< T, Compare >::Iterator::get_curr_ne(), Aleph::DynArrayHeap< T, Compare >::Iterator::get_pos(), Aleph::DynArrayHeap< T, Compare >::Iterator::has_curr(), Aleph::DynArrayHeap< T, Compare >::Iterator::is_last(), Aleph::DynArrayHeap< T, Compare >::Iterator::next(), Aleph::DynArrayHeap< T, Compare >::Iterator::next_ne(), Aleph::DynArrayHeap< T, Compare >::Iterator::prev(), Aleph::DynArrayHeap< T, Compare >::Iterator::prev_ne(), Aleph::DynArrayHeap< T, Compare >::Iterator::reset_first(), Aleph::DynArrayHeap< T, Compare >::Iterator::reset_last(), and Aleph::DynArrayHeap< T, Compare >::Iterator::set_pos().
|
private |
The heap; none in an iterator built without one.
Definition at line 578 of file tpl_dynArrayHeap.H.
Referenced by Aleph::DynArrayHeap< T, Compare >::Iterator::get_curr_ne(), Aleph::DynArrayHeap< T, Compare >::Iterator::items(), and Aleph::DynArrayHeap< T, Compare >::Iterator::next().