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

Iterator that traverses multiple containers (STL or Aleph) in lockstep. More...

#include <ah-zip-utils.H>

Collaboration diagram for Aleph::UniZipIterator< Containers >:
[legend]

Public Types

using value_type = std::tuple< uni_zip_detail::container_value_t< Containers >... >
 

Public Member Functions

 UniZipIterator (const Containers &... cs)
 
bool has_curr () const noexcept
 Returns true if ALL containers have current element (zip continues)
 
bool any_has_curr () const noexcept
 Returns true if ANY container still has elements (for length checking)
 
bool all_completed () const noexcept
 Returns true if ALL containers are exhausted (equal length check)
 
bool completed () const noexcept
 
auto get_curr () const
 
void next ()
 
void next_ne ()
 Advance without checking; same as next(), which does not check.
 
auto operator* () const
 
UniZipIterator & operator++ ()
 
bool operator== (UniZipSentinel) const noexcept
 Comparison with sentinel - iterator is "at end" when any container exhausted.
 
bool operator!= (UniZipSentinel s) const noexcept
 
bool operator== (const UniZipIterator &other) const noexcept
 Comparison with another iterator (for algorithms that need it)
 
bool operator!= (const UniZipIterator &other) const noexcept
 

Static Public Attributes

static constexpr size_t num_containers = sizeof...(Containers)
 

Private Member Functions

template<size_t... Is>
bool has_curr_impl (std::index_sequence< Is... >) const noexcept
 
template<size_t... Is>
bool any_has_curr_impl (std::index_sequence< Is... >) const noexcept
 
template<size_t... Is>
bool all_completed_impl (std::index_sequence< Is... >) const noexcept
 
template<size_t... Is>
auto get_curr_impl (std::index_sequence< Is... >) const
 
template<size_t... Is>
void next_impl (std::index_sequence< Is... >)
 

Private Attributes

std::tuple< uni_zip_detail::iterator_wrapper_t< Containers >... > iters_
 

Detailed Description

template<typename... Containers>
class Aleph::UniZipIterator< Containers >

Iterator that traverses multiple containers (STL or Aleph) in lockstep.

This iterator automatically adapts to the container type, allowing you to zip together any combination of STL and Aleph containers.

Template Parameters
ContainersParameter pack of container types.
See also
uni_zip() Factory function
Author
Leandro Rabindranath León

Definition at line 248 of file ah-zip-utils.H.

Member Typedef Documentation

◆ value_type

template<typename... Containers>
using Aleph::UniZipIterator< Containers >::value_type = std::tuple<uni_zip_detail::container_value_t<Containers>...>

Definition at line 254 of file ah-zip-utils.H.

Constructor & Destructor Documentation

◆ UniZipIterator()

template<typename... Containers>
Aleph::UniZipIterator< Containers >::UniZipIterator ( const Containers &...  cs)
inlineexplicit

Definition at line 292 of file ah-zip-utils.H.

Member Function Documentation

◆ all_completed()

template<typename... Containers>
bool Aleph::UniZipIterator< Containers >::all_completed ( ) const
inlinenoexcept

Returns true if ALL containers are exhausted (equal length check)

Definition at line 308 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::all_completed_impl().

Referenced by Aleph::UniZipIterator< Containers >::completed().

◆ all_completed_impl()

template<typename... Containers>
template<size_t... Is>
bool Aleph::UniZipIterator< Containers >::all_completed_impl ( std::index_sequence< Is... >  ) const
inlineprivatenoexcept

◆ any_has_curr()

template<typename... Containers>
bool Aleph::UniZipIterator< Containers >::any_has_curr ( ) const
inlinenoexcept

Returns true if ANY container still has elements (for length checking)

Definition at line 302 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::any_has_curr_impl().

◆ any_has_curr_impl()

template<typename... Containers>
template<size_t... Is>
bool Aleph::UniZipIterator< Containers >::any_has_curr_impl ( std::index_sequence< Is... >  ) const
inlineprivatenoexcept

◆ completed()

template<typename... Containers>
bool Aleph::UniZipIterator< Containers >::completed ( ) const
inlinenoexcept
Deprecated:
Use all_completed() for clarity. Kept for backward compatibility.

Definition at line 314 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::all_completed().

Referenced by Aleph::UniZipIterator< Containers >::all_completed_impl().

◆ get_curr()

◆ get_curr_impl()

template<typename... Containers>
template<size_t... Is>
auto Aleph::UniZipIterator< Containers >::get_curr_impl ( std::index_sequence< Is... >  ) const
inlineprivate

◆ has_curr()

◆ has_curr_impl()

template<typename... Containers>
template<size_t... Is>
bool Aleph::UniZipIterator< Containers >::has_curr_impl ( std::index_sequence< Is... >  ) const
inlineprivatenoexcept

◆ next()

◆ next_impl()

template<typename... Containers>
template<size_t... Is>
void Aleph::UniZipIterator< Containers >::next_impl ( std::index_sequence< Is... >  )
inlineprivate

◆ next_ne()

template<typename... Containers>
void Aleph::UniZipIterator< Containers >::next_ne ( )
inline

Advance without checking; same as next(), which does not check.

Provided so the adaptor satisfies AlephIterator and works in generic code that advances with next_ne() under a has_curr() guard.

Definition at line 334 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::next().

◆ operator!=() [1/2]

template<typename... Containers>
bool Aleph::UniZipIterator< Containers >::operator!= ( const UniZipIterator< Containers > &  other) const
inlinenoexcept

Definition at line 363 of file ah-zip-utils.H.

References Aleph::blossom_maximum_cardinality_matching().

◆ operator!=() [2/2]

template<typename... Containers>
bool Aleph::UniZipIterator< Containers >::operator!= ( UniZipSentinel  s) const
inlinenoexcept

Definition at line 351 of file ah-zip-utils.H.

◆ operator*()

template<typename... Containers>
auto Aleph::UniZipIterator< Containers >::operator* ( ) const
inline

Definition at line 337 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::get_curr().

◆ operator++()

template<typename... Containers>
UniZipIterator & Aleph::UniZipIterator< Containers >::operator++ ( )
inline

Definition at line 339 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::next().

◆ operator==() [1/2]

template<typename... Containers>
bool Aleph::UniZipIterator< Containers >::operator== ( const UniZipIterator< Containers > &  other) const
inlinenoexcept

Comparison with another iterator (for algorithms that need it)

Definition at line 357 of file ah-zip-utils.H.

References Aleph::blossom_maximum_cardinality_matching(), and Aleph::UniZipIterator< Containers >::has_curr().

◆ operator==() [2/2]

template<typename... Containers>
bool Aleph::UniZipIterator< Containers >::operator== ( UniZipSentinel  ) const
inlinenoexcept

Comparison with sentinel - iterator is "at end" when any container exhausted.

Definition at line 346 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::has_curr().

Member Data Documentation

◆ iters_

◆ num_containers

template<typename... Containers>
constexpr size_t Aleph::UniZipIterator< Containers >::num_containers = sizeof...(Containers)
staticconstexpr

Definition at line 290 of file ah-zip-utils.H.


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