Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::EnumZipIterator< C > Class Template Reference

Base case of EnumZipIterator: the read-only iterator of the last container, which also counts the position. More...

#include <ah-zip.H>

Inheritance diagram for Aleph::EnumZipIterator< C >:
[legend]
Collaboration diagram for Aleph::EnumZipIterator< C >:
[legend]

Public Types

using T = std::decay_t< typename C::Item_Type >
 
- Public Types inherited from Aleph::Const_Iterator< It >
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

void next ()
 Advance the iterator and increment the associated index (bounds-checked).
 
void next_ne () noexcept(noexcept(std::declval< Base & >().next_ne()))
 Advance the iterator and increment the associated index (unchecked variant).
 
 EnumZipIterator (const C &c)
 Construct an enumerating iterator over a single container.
 
std::tuple< T, size_t > get_curr () const
 Return the current tuple (value, index) (bounds-checked).
 
std::tuple< T, size_t > get_curr_ne () const noexcept(zip_detail::nothrow_curr_copy< Base, T >)
 Return the current tuple (value, index) (unchecked variant).
 
bool completed () const noexcept
 Return true if the underlying iterator has reached the end.
 
- Public Member Functions inherited from Aleph::Const_Iterator< It >
 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 ==.
 

Private Types

using Base = Aleph::const_iterator_t< C >
 

Private Attributes

size_t i = 0
 

Additional Inherited Members

- Protected Member Functions inherited from Aleph::Const_Iterator< It >
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()).
 

Detailed Description

template<class C>
class Aleph::EnumZipIterator< C >

Base case of EnumZipIterator: the read-only iterator of the last container, which also counts the position.

Template Parameters
Cthe last container.

Definition at line 1325 of file ah-zip.H.

Member Typedef Documentation

◆ Base

template<class C >
using Aleph::EnumZipIterator< C >::Base = Aleph::const_iterator_t<C>
private

Definition at line 1327 of file ah-zip.H.

◆ T

template<class C >
using Aleph::EnumZipIterator< C >::T = std::decay_t<typename C::Item_Type>

Definition at line 1350 of file ah-zip.H.

Constructor & Destructor Documentation

◆ EnumZipIterator()

template<class C >
Aleph::EnumZipIterator< C >::EnumZipIterator ( const C &  c)
inline

Construct an enumerating iterator over a single container.

Parameters
[in]cContainer to iterate.

Definition at line 1356 of file ah-zip.H.

Member Function Documentation

◆ completed()

template<class C >
bool Aleph::EnumZipIterator< C >::completed ( ) const
inlinenoexcept

Return true if the underlying iterator has reached the end.

Definition at line 1381 of file ah-zip.H.

References Aleph::has_curr().

◆ get_curr()

template<class C >
std::tuple< T, size_t > Aleph::EnumZipIterator< C >::get_curr ( ) const
inline

Return the current tuple (value, index) (bounds-checked).

Definition at line 1359 of file ah-zip.H.

◆ get_curr_ne()

template<class C >
std::tuple< T, size_t > Aleph::EnumZipIterator< C >::get_curr_ne ( ) const
inlinenoexcept

Return the current tuple (value, index) (unchecked variant).

Requires has_curr().

Returns
a tuple with a copy of the current item and its position.
Exceptions
whatreading the current item throws, as the get_curr_ne() of the iterator of a container that the user wrote may do even when its item is arithmetic, and what copying it throws.
Note
It is noexcept only when neither can throw, so that what they throw reaches the caller instead of ending the program.

Definition at line 1375 of file ah-zip.H.

◆ next()

template<class C >
void Aleph::EnumZipIterator< C >::next ( )
inline

Advance the iterator and increment the associated index (bounds-checked).

Definition at line 1332 of file ah-zip.H.

◆ next_ne()

template<class C >
void Aleph::EnumZipIterator< C >::next_ne ( )
inlinenoexcept

Advance the iterator and increment the associated index (unchecked variant).

Requires has_curr().

Exceptions
whatnext_ne() of the underlying iterator throws.

Definition at line 1344 of file ah-zip.H.

Member Data Documentation

◆ i

template<class C >
size_t Aleph::EnumZipIterator< C >::i = 0
private

Definition at line 1328 of file ah-zip.H.


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