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

Base case of ZipIterator: the read-only iterator of the last container. More...

#include <ah-zip.H>

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

Public Types

using Base = Aleph::const_iterator_t< C >
 
using T = std::decay_t< typename C::Item_Type >
 
using Tuple_Type = std::tuple< T >
 The tuple type returned by get_curr() and get_curr_ne()
 
using Item_Type = T
 Type of elements from the container.
 
- 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

 ZipIterator (const C &c)
 Construct a zip iterator over a single container.
 
std::tuple< T > get_curr () const
 Return the current tuple (bounds-checked).
 
std::tuple< T > get_curr_ne () const noexcept(zip_detail::nothrow_curr_copy< Base, T >)
 Return the current tuple (unchecked variant).
 
DynList< T > get_curr_list () const
 
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 ==.
 

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::ZipIterator< C >

Base case of ZipIterator: the read-only iterator of the last container.

The zipped containers are never modified: the iterator of each one is its Aleph::const_iterator_t, whose get_curr() hands out a reference to const.

Template Parameters
Cthe last container.

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

Member Typedef Documentation

◆ Base

template<class C >
using Aleph::ZipIterator< C >::Base = Aleph::const_iterator_t<C>

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

◆ Item_Type

template<class C >
using Aleph::ZipIterator< C >::Item_Type = T

Type of elements from the container.

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

◆ T

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

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

◆ Tuple_Type

template<class C >
using Aleph::ZipIterator< C >::Tuple_Type = std::tuple<T>

The tuple type returned by get_curr() and get_curr_ne()

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

Constructor & Destructor Documentation

◆ ZipIterator()

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

Construct a zip iterator over a single container.

This is mainly used as the base case for the recursive ZipIterator.

Parameters
[in]cContainer to iterate.

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

Member Function Documentation

◆ completed()

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

Return true if the underlying iterator has reached the end.

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

References Aleph::has_curr().

◆ get_curr()

template<class C >
std::tuple< T > Aleph::ZipIterator< C >::get_curr ( ) const
inline

Return the current tuple (bounds-checked).

Exceptions
std::overflow_errorif the iterator is past the end.

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

◆ get_curr_list()

template<class C >
DynList< T > Aleph::ZipIterator< C >::get_curr_list ( ) const
inline

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

References Aleph::DynList< T >::append(), and l.

◆ get_curr_ne()

template<class C >
std::tuple< T > Aleph::ZipIterator< C >::get_curr_ne ( ) const
inlinenoexcept

Return the current tuple (unchecked variant).

Requires has_curr().

Returns
a tuple with a copy of the current item.
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 310 of file ah-zip.H.


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