|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Read-only view of an Aleph iterator: the iterator of a constant container. More...
#include <ah-iterator.H>
Public Types | |
| using | Itor = It |
| The underlying iterator. | |
| using | aleph_random_access_iterator = std::conditional_t< AlephRandomAccessItor< It >, Const_Iterator, void > |
| Random access when the underlying iterator opts in; see AlephRandomAccessItor. | |
Public Member Functions | |
| Const_Iterator ()=default | |
| A view with no current item. | |
| template<class C > requires (not std::same_as<std::remove_cvref_t<C>, Const_Iterator> and not std::same_as<std::remove_cvref_t<C>, It>) | |
| Const_Iterator (const C &c) | |
View positioned on the first item of the container c. | |
| Const_Iterator (It underlying) noexcept(std::is_nothrow_move_constructible_v< It >) | |
| Read-only view over an existing iterator. | |
| template<class I = It> | |
| auto | has_curr () const noexcept(noexcept(std::declval< I & >().has_curr())) -> decltype(std::declval< I & >().has_curr()) |
true if there is a current item. | |
| template<class I = It> | |
| auto | get_curr () const noexcept(noexcept(std::declval< I & >().get_curr())) -> const_iterator_detail::const_item_t< decltype(std::declval< I & >().get_curr())> |
| The current item, read-only. | |
| template<class I = It> | |
| auto | get_curr_ne () const noexcept(noexcept(std::declval< I & >().get_curr_ne())) -> const_iterator_detail::const_item_t< decltype(std::declval< I & >().get_curr_ne())> |
| get_curr() without the checks of the underlying iterator. | |
| template<class I = It> | |
| auto | next () noexcept(noexcept(std::declval< I & >().next())) -> decltype(std::declval< I & >().next()) |
| Move to the next item; what the underlying iterator throws. | |
| template<class I = It> | |
| auto | next_ne () noexcept(noexcept(std::declval< I & >().next_ne())) -> decltype(std::declval< I & >().next_ne()) |
| next() without checks. | |
| template<class I = It> | |
| auto | prev () noexcept(noexcept(std::declval< I & >().prev())) -> decltype(std::declval< I & >().prev()) |
| Move to the previous item; what the underlying iterator throws. | |
| template<class I = It> | |
| auto | prev_ne () noexcept(noexcept(std::declval< I & >().prev_ne())) -> decltype(std::declval< I & >().prev_ne()) |
| prev() without checks. | |
| template<class I = It> | |
| auto | reset_first () noexcept(noexcept(std::declval< I & >().reset_first())) -> decltype(std::declval< I & >().reset_first()) |
| Position the view on the first item. | |
| template<class I = It> | |
| auto | reset_last () noexcept(noexcept(std::declval< I & >().reset_last())) -> decltype(std::declval< I & >().reset_last()) |
| Position the view on the last item. | |
| template<class I = It> | |
| auto | reset () noexcept(noexcept(std::declval< I & >().reset())) -> decltype(std::declval< I & >().reset()) |
| Position the view on the first item. | |
| template<class I = It> | |
| auto | end () noexcept(noexcept(std::declval< I & >().end())) -> decltype(std::declval< I & >().end()) |
| Position the view past the last item. | |
| template<class I = It> | |
| auto | get_pos () const noexcept(noexcept(std::declval< I & >().get_pos())) -> decltype(std::declval< I & >().get_pos()) |
| Ordinal position of the current item. | |
| template<class I = It> | |
| auto | set_pos (const long pos) noexcept(noexcept(std::declval< I & >().set_pos(pos))) -> decltype(std::declval< I & >().set_pos(pos)) |
Position the view on the item at ordinal position pos. | |
| template<class I = It> | |
| auto | is_last () const noexcept(noexcept(std::declval< I & >().is_last())) -> decltype(std::declval< I & >().is_last()) |
true if the current item is the last one. | |
| template<class I = It> | |
| auto | is_in_first () const noexcept(noexcept(std::declval< I & >().is_in_first())) -> decltype(std::declval< I & >().is_in_first()) |
true if the current item is the first one. | |
| template<class I = It> | |
| auto | is_in_last () const noexcept(noexcept(std::declval< I & >().is_in_last())) -> decltype(std::declval< I & >().is_in_last()) |
true if the current item is the last one. | |
| void | swap (Const_Iterator &other) noexcept(std::is_nothrow_swappable_v< It >) |
| Exchange the views. | |
| template<class I = It> | |
| auto | operator== (const Const_Iterator &other) const -> decltype(std::declval< I & >()==std::declval< I & >()) |
| Equality of the underlying iterators, when they have it. | |
| template<class I = It> | |
| auto | operator!= (const Const_Iterator &other) const -> decltype(not(std::declval< I & >()==std::declval< I & >())) |
Negation of ==. | |
Protected Member Functions | |
| It & | underlying () const noexcept |
The underlying iterator, for the views that extend the reading protocol with members of their own (the read-only iterators of the graphs do it with get_src_node() and get_tgt_node()). | |
Static Private Member Functions | |
| template<class C > | |
| static It | make (const C &c) |
Private Attributes | |
| It | it |
Read-only view of an Aleph iterator: the iterator of a constant container.
Const_Iterator<It> wraps the iterator It of a container and exposes its reading protocol (has_curr(), get_curr(), next(), prev(), reset_first(), get_pos()...) and nothing else: get_curr() hands out the current item as a reference to const (a pointer to const for the iterators that hand out pointers), and the members that modify the container through the iterator (del(), set(), insert()...) do not exist. It is what get_it() returns on a constant container, and the const_iterator of the STL interface of every container. Each member exists only when the underlying iterator has it, and so do the typedefs Item_Type and Set_Type.
The underlying iterator is built from the constant container through a constructor that accepts it when the iterator has one (DynArray keeps one, so that the view never allocates); otherwise through a const_cast that stays harmless, because the view exposes nothing modifiable.
| It | the iterator of the container. |
Definition at line 336 of file ah-iterator.H.
| using Aleph::Const_Iterator< It >::aleph_random_access_iterator = std::conditional_t<AlephRandomAccessItor<It>, Const_Iterator, void> |
Random access when the underlying iterator opts in; see AlephRandomAccessItor.
Definition at line 364 of file ah-iterator.H.
| using Aleph::Const_Iterator< It >::Itor = It |
The underlying iterator.
Definition at line 361 of file ah-iterator.H.
|
default |
A view with no current item.
|
inlineexplicit |
View positioned on the first item of the container c.
| [in] | c | the container; it is never modified through the view. |
Definition at line 376 of file ah-iterator.H.
|
inlineexplicitnoexcept |
Read-only view over an existing iterator.
| [in] | underlying | the iterator; the view starts at its position. |
Definition at line 381 of file ah-iterator.H.
|
inlinenoexcept |
Position the view past the last item.
Definition at line 465 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by TEST().
|
inlinenoexcept |
The current item, read-only.
| what | get_curr() of the underlying iterator throws. |
Definition at line 398 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by Aleph::Path< GT >::Iterator::get_curr_path_desc(), Aleph::Path< GT >::get_last_arc(), Aleph::is_inversely_sorted(), Aleph::is_sorted(), Aleph::search_extreme(), Aleph::search_inversion(), TEST(), and Aleph::test_sorted().
|
inlinenoexcept |
get_curr() without the checks of the underlying iterator.
Definition at line 406 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by Aleph::Path< GT >::Iterator::get_curr_path_desc_ne(), and TEST().
|
inlinenoexcept |
Ordinal position of the current item.
Definition at line 472 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by StlConstIterator< SetType >::operator==(), and TEST().
|
inlinenoexcept |
true if there is a current item.
Definition at line 386 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by Aleph::Const_Graph_View< GT >::adjacent_nodes(), Aleph::Const_Graph_View< GT >::arcs(), Aleph::Const_Graph_View< GT >::arcs(), Aleph::Const_Graph_View< GT >::arcs_map(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::build_path(), Aleph::Const_Graph_View< GT >::count_arcs(), Aleph::Const_Graph_View< GT >::count_nodes(), demo_any_path(), demo_degrees_of_separation(), EqualSequenceMethod< Container >::equal_to(), EqualSortedMethod< Container >::equal_to(), Aleph::Const_Graph_View< GT >::filter_arcs(), Aleph::Const_Graph_View< GT >::filter_arcs(), Aleph::Const_Graph_View< GT >::filter_nodes(), Aleph::Const_Graph_View< GT >::foldl_arcs(), Aleph::Const_Graph_View< GT >::foldl_nodes(), Aleph::Const_Graph_View< GT >::for_each_arc(), Aleph::Const_Graph_View< GT >::for_each_arc(), Aleph::Const_Graph_View< GT >::for_each_node(), Aleph::generate_dot_file(), Aleph::Path< GT >::Iterator::has_current_arc(), Aleph::Path< GT >::Iterator::has_current_node(), imprimir_camino(), Aleph::is_inversely_sorted(), Aleph::is_sorted(), Aleph::Const_Graph_View< GT >::nodes(), Aleph::Const_Graph_View< GT >::nodes_map(), path_edge_count(), print_grid_with_path(), Aleph::Const_Graph_View< GT >::search_arc(), Aleph::Const_Graph_View< GT >::search_arc(), Aleph::Const_Graph_View< GT >::search_arc(), Aleph::search_extreme(), Aleph::search_inversion(), Aleph::Const_Graph_View< GT >::search_node(), Aleph::sequential_search(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), Aleph::test_sorted(), Aleph::Const_Graph_View< GT >::traverse_arcs(), Aleph::Const_Graph_View< GT >::traverse_arcs(), Aleph::Const_Graph_View< GT >::traverse_nodes(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().
|
inlinenoexcept |
true if the current item is the first one.
Definition at line 496 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
|
inlinenoexcept |
true if the current item is the last one.
Definition at line 504 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by Aleph::Path< GT >::Iterator::get_current_arc(), Aleph::Path< GT >::Iterator::has_current_arc(), and TEST().
|
inlinenoexcept |
true if the current item is the last one.
Definition at line 488 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
|
inlinestaticprivate |
Definition at line 343 of file ah-iterator.H.
|
inlinenoexcept |
Move to the next item; what the underlying iterator throws.
Definition at line 414 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by TEST(), TYPED_TEST(), and TYPED_TEST().
|
inlinenoexcept |
next() without checks.
Definition at line 421 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by Aleph::is_inversely_sorted(), Aleph::is_sorted(), Aleph::search_extreme(), Aleph::search_inversion(), and Aleph::test_sorted().
|
inline |
Negation of ==.
Definition at line 527 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
|
inline |
Equality of the underlying iterators, when they have it.
Definition at line 519 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
|
inlinenoexcept |
Move to the previous item; what the underlying iterator throws.
Definition at line 428 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by Aleph::Path< GT >::get_last_arc(), and TEST().
|
inlinenoexcept |
prev() without checks.
Definition at line 435 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
|
inlinenoexcept |
Position the view on the first item.
Definition at line 458 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
|
inlinenoexcept |
Position the view on the first item.
Definition at line 442 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by TEST().
|
inlinenoexcept |
Position the view on the last item.
Definition at line 450 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by Aleph::Path< GT >::get_last_arc(), and TEST().
|
inlinenoexcept |
Position the view on the item at ordinal position pos.
Definition at line 480 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
Referenced by Aleph::DynArray< T >::get_it().
|
inlinenoexcept |
Exchange the views.
Definition at line 511 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it, and Aleph::Const_Iterator< It >::swap().
Referenced by Aleph::Const_Iterator< It >::swap(), and TEST().
|
inlineprotectednoexcept |
The underlying iterator, for the views that extend the reading protocol with members of their own (the read-only iterators of the graphs do it with get_src_node() and get_tgt_node()).
Definition at line 357 of file ah-iterator.H.
References Aleph::Const_Iterator< It >::it.
|
mutableprivate |
Definition at line 340 of file ah-iterator.H.
Referenced by Aleph::Const_Iterator< It >::end(), Aleph::Const_Iterator< It >::get_curr(), Aleph::Const_Iterator< It >::get_curr_ne(), Aleph::Const_Iterator< It >::get_pos(), Aleph::Const_Iterator< It >::has_curr(), Aleph::Const_Iterator< It >::is_in_first(), Aleph::Const_Iterator< It >::is_in_last(), Aleph::Const_Iterator< It >::is_last(), Aleph::Const_Iterator< It >::next(), Aleph::Const_Iterator< It >::next_ne(), Aleph::Const_Iterator< It >::operator!=(), Aleph::Const_Iterator< It >::operator==(), Aleph::Const_Iterator< It >::prev(), Aleph::Const_Iterator< It >::prev_ne(), Aleph::Const_Iterator< It >::reset(), Aleph::Const_Iterator< It >::reset_first(), Aleph::Const_Iterator< It >::reset_last(), Aleph::Const_Iterator< It >::set_pos(), Aleph::Const_Iterator< It >::swap(), and Aleph::Const_Iterator< It >::underlying().