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>

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 ()
 
auto operator* () const
 
UniZipIteratoroperator++ ()
 
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 247 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 253 of file ah-zip-utils.H.

Constructor & Destructor Documentation

◆ UniZipIterator()

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

Definition at line 291 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 307 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 301 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 313 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()

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

◆ next_impl()

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

◆ operator!=() [1/2]

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

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

References Aleph::maps().

◆ operator!=() [2/2]

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

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

◆ operator*()

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

Definition at line 329 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 331 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 349 of file ah-zip-utils.H.

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

◆ 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 338 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 289 of file ah-zip-utils.H.


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