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

Lazy view over multiple zipped containers (STL or Aleph). More...

#include <ah-zip-utils.H>

Public Types

using iterator = UniZipIterator< std::decay_t< Containers >... >
 
using sentinel = UniZipSentinel
 
using value_type = typename iterator::value_type
 

Public Member Functions

 UniZipView (const Containers &...cs)
 Constructor from containers.
 
iterator begin () const
 Returns an iterator to the beginning.
 
sentinel end () const noexcept
 O(1) end() using sentinel.
 
bool empty () const
 Check if the zipped view is empty.
 
size_t size () const
 Note: O(n) - iterates through all elements to count.
 

Private Attributes

std::tuple< const std::decay_t< Containers > &... > containers_
 

Detailed Description

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

Lazy view over multiple zipped containers (STL or Aleph).

Template Parameters
ContainersTypes of containers being zipped.
Author
Leandro Rabindranath León

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

Member Typedef Documentation

◆ iterator

template<typename... Containers>
using Aleph::UniZipView< Containers >::iterator = UniZipIterator<std::decay_t<Containers>...>

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

◆ sentinel

template<typename... Containers>
using Aleph::UniZipView< Containers >::sentinel = UniZipSentinel

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

◆ value_type

template<typename... Containers>
using Aleph::UniZipView< Containers >::value_type = typename iterator::value_type

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

Constructor & Destructor Documentation

◆ UniZipView()

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

Constructor from containers.

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

Member Function Documentation

◆ begin()

template<typename... Containers>
iterator Aleph::UniZipView< Containers >::begin ( ) const
inline

Returns an iterator to the beginning.

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

References Aleph::UniZipView< Containers >::containers_.

Referenced by Aleph::UniZipView< Containers >::empty(), and Aleph::UniZipView< Containers >::size().

◆ empty()

template<typename... Containers>
bool Aleph::UniZipView< Containers >::empty ( ) const
inline

Check if the zipped view is empty.

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

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

◆ end()

template<typename... Containers>
sentinel Aleph::UniZipView< Containers >::end ( ) const
inlinenoexcept

O(1) end() using sentinel.

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

Referenced by Aleph::UniZipView< Containers >::size().

◆ size()

template<typename... Containers>
size_t Aleph::UniZipView< Containers >::size ( ) const
inline

Note: O(n) - iterates through all elements to count.

Get the number of elements in the zipped view

Note
This is O(n) as it iterates through the shortest container

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

References Aleph::UniZipView< Containers >::begin(), Aleph::count(), and Aleph::UniZipView< Containers >::end().

Member Data Documentation

◆ containers_

template<typename... Containers>
std::tuple<const std::decay_t<Containers> &...> Aleph::UniZipView< Containers >::containers_
private

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

Referenced by Aleph::UniZipView< Containers >::begin().


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