Vcsn  2.2
Be Rational
vcsn::zipped_maps< Dereference, Maps >::iterator Struct Reference

Composite iterator. More...

#include <zip-maps.hh>

Collaboration diagram for vcsn::zipped_maps< Dereference, Maps >::iterator:

Public Types

template<typename T >
using iterator_t = typename std::remove_reference_t< T >::const_iterator
 
using iterators_t = std::tuple< iterator_t< Maps >... >
 
template<typename T >
using value_t = typename std::remove_reference_t< T >::value_type
 
using values_t = std::tuple< value_t< Maps >... >
 
using references_t = std::tuple< const value_t< Maps > &... >
 
template<typename T >
using range_t = std::pair< iterator_t< T >, iterator_t< T >>
 
using ranges_t = std::tuple< range_t< Maps >... >
 
using key_t = std::remove_const_t< typename tuple_element_t< 0, values_t >::first_type >
 Common key type. More...
 
using mapped_t = std::tuple< const typename std::remove_reference_t< Maps >::mapped_type &... >
 Tuple of mapped types. More...
 

Public Member Functions

 iterator (zipped_maps &zip, iterator_t< Maps >...is, iterator_t< Maps >...ends)
 
iteratoroperator++ ()
 Advance to next position. More...
 
bool operator!= (const iterator &that) const
 
auto dereference_ (as_pair) -> std::pair< key_t, mapped_t >
 Return as <k1, <v1, v2...>>. More...
 
auto dereference_ (as_tuple) -> references_t
 Return as <<k1, v1>, <k1, v2>, ...>. More...
 
auto operator* () -> decltype(this->dereference_(Dereference()))
 

Public Attributes

zipped_mapszip_
 The maps etc. More...
 
iterators_t is_
 The current position. More...
 
iterators_t ends_
 The genuine ends. More...
 
bool is_done_
 Whether we reached the end. More...
 

Private Member Functions

void done_ ()
 We have reached the end, move all the cursors to this end. More...
 
void align_ ()
 Align all iterators on the first common key. More...
 
template<std::size_t... I>
key_t align_ (key_t k, seq< I... >)
 Try to align all the ranges to support key k. More...
 
template<std::size_t I>
key_t align_ (key_t k)
 Given the current candidate key, try to find the proper range for I. More...
 
template<std::size_t... I>
bool not_equal_ (const iterator &that, seq< I... >) const
 
key_t dereference_first_ () const
 The common key. More...
 
template<std::size_t... I>
mapped_t dereference_second_ (seq< I... >) const
 The associated tuple of values. More...
 
template<std::size_t... I>
references_t dereference_ (seq< I... >) const
 Tuple of pairs. More...
 

Detailed Description

template<typename Dereference = as_tuple, typename... Maps>
struct vcsn::zipped_maps< Dereference, Maps >::iterator

Composite iterator.

Definition at line 38 of file zip-maps.hh.

Member Typedef Documentation

template<typename Dereference = as_tuple, typename... Maps>
template<typename T >
using vcsn::zipped_maps< Dereference, Maps >::iterator::iterator_t = typename std::remove_reference_t<T>::const_iterator

Definition at line 41 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
using vcsn::zipped_maps< Dereference, Maps >::iterator::iterators_t = std::tuple<iterator_t<Maps>...>

Definition at line 42 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
using vcsn::zipped_maps< Dereference, Maps >::iterator::key_t = std::remove_const_t<typename tuple_element_t<0, values_t>::first_type>

Common key type.

Definition at line 58 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
using vcsn::zipped_maps< Dereference, Maps >::iterator::mapped_t = std::tuple<const typename std::remove_reference_t<Maps>::mapped_type&...>

Tuple of mapped types.

Definition at line 61 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
template<typename T >
using vcsn::zipped_maps< Dereference, Maps >::iterator::range_t = std::pair<iterator_t<T>, iterator_t<T>>

Definition at line 53 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
using vcsn::zipped_maps< Dereference, Maps >::iterator::ranges_t = std::tuple<range_t<Maps>...>

Definition at line 54 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
using vcsn::zipped_maps< Dereference, Maps >::iterator::references_t = std::tuple<const value_t<Maps>&...>

Definition at line 50 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
template<typename T >
using vcsn::zipped_maps< Dereference, Maps >::iterator::value_t = typename std::remove_reference_t<T>::value_type

Definition at line 45 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
using vcsn::zipped_maps< Dereference, Maps >::iterator::values_t = std::tuple<value_t<Maps>...>

Definition at line 46 of file zip-maps.hh.

Constructor & Destructor Documentation

template<typename Dereference = as_tuple, typename... Maps>
vcsn::zipped_maps< Dereference, Maps >::iterator::iterator ( zipped_maps zip,
iterator_t< Maps >...  is,
iterator_t< Maps >...  ends 
)
inline

Definition at line 63 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::align_().

Referenced by vcsn::zipped_maps< Dereference, Maps >::begin_(), and vcsn::zipped_maps< Dereference, Maps >::end_().

Here is the call graph for this function:

Member Function Documentation

template<typename Dereference = as_tuple, typename... Maps>
void vcsn::zipped_maps< Dereference, Maps >::iterator::align_ ( )
inlineprivate

Align all iterators on the first common key.

Called at construction of the iterators, including end(), therefore must be robust to be already at end().

Definition at line 128 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::done_(), and vcsn::zipped_maps< Dereference, Maps >::iterator::is_.

Referenced by vcsn::zipped_maps< Dereference, Maps >::iterator::iterator(), and vcsn::zipped_maps< Dereference, Maps >::iterator::operator++().

Here is the call graph for this function:

template<typename Dereference = as_tuple, typename... Maps>
template<std::size_t... I>
key_t vcsn::zipped_maps< Dereference, Maps >::iterator::align_ ( key_t  k,
seq< I... >   
)
inlineprivate

Try to align all the ranges to support key k.

Return the smallest candidate key.

Definition at line 149 of file zip-maps.hh.

References vcsn::detail::void.

template<typename Dereference = as_tuple, typename... Maps>
template<std::size_t I>
key_t vcsn::zipped_maps< Dereference, Maps >::iterator::align_ ( key_t  k)
inlineprivate

Given the current candidate key, try to find the proper range for I.

Return the first supported key <= k.

Definition at line 159 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::done_(), vcsn::zipped_maps< Dereference, Maps >::iterator::is_, and vcsn::zipped_maps< Dereference, Maps >::maps_.

Here is the call graph for this function:

template<typename Dereference = as_tuple, typename... Maps>
auto vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_ ( as_pair  ) -> std::pair<key_t, mapped_t>
inline

Return as <k1, <v1, v2...>>.

Definition at line 100 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_first_(), and vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_second_().

Referenced by vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_(), and vcsn::zipped_maps< Dereference, Maps >::iterator::operator*().

Here is the call graph for this function:

template<typename Dereference = as_tuple, typename... Maps>
auto vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_ ( as_tuple  ) -> references_t
inline

Return as <<k1, v1>, <k1, v2>, ...>.

Definition at line 106 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_().

Here is the call graph for this function:

template<typename Dereference = as_tuple, typename... Maps>
template<std::size_t... I>
references_t vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_ ( seq< I... >  ) const
inlineprivate

Tuple of pairs.

Definition at line 204 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::is_.

template<typename Dereference = as_tuple, typename... Maps>
key_t vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_first_ ( ) const
inlineprivate
template<typename Dereference = as_tuple, typename... Maps>
template<std::size_t... I>
mapped_t vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_second_ ( seq< I... >  ) const
inlineprivate

The associated tuple of values.

Definition at line 195 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::is_.

Referenced by vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_().

template<typename Dereference = as_tuple, typename... Maps>
void vcsn::zipped_maps< Dereference, Maps >::iterator::done_ ( )
inlineprivate

We have reached the end, move all the cursors to this end.

Definition at line 118 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::ends_.

Referenced by vcsn::zipped_maps< Dereference, Maps >::iterator::align_().

template<typename Dereference = as_tuple, typename... Maps>
template<std::size_t... I>
bool vcsn::zipped_maps< Dereference, Maps >::iterator::not_equal_ ( const iterator that,
seq< I... >   
) const
inlineprivate
template<typename Dereference = as_tuple, typename... Maps>
bool vcsn::zipped_maps< Dereference, Maps >::iterator::operator!= ( const iterator that) const
inline

Definition at line 94 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::not_equal_().

Here is the call graph for this function:

template<typename Dereference = as_tuple, typename... Maps>
auto vcsn::zipped_maps< Dereference, Maps >::iterator::operator* ( ) -> decltype(this->dereference_(Dereference()))
inline

Definition at line 111 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::dereference_().

Here is the call graph for this function:

template<typename Dereference = as_tuple, typename... Maps>
iterator& vcsn::zipped_maps< Dereference, Maps >::iterator::operator++ ( )
inline

Advance to next position.

Definition at line 84 of file zip-maps.hh.

References vcsn::zipped_maps< Dereference, Maps >::iterator::align_(), and vcsn::zipped_maps< Dereference, Maps >::iterator::is_.

Here is the call graph for this function:

Member Data Documentation

template<typename Dereference = as_tuple, typename... Maps>
iterators_t vcsn::zipped_maps< Dereference, Maps >::iterator::ends_

The genuine ends.

Definition at line 79 of file zip-maps.hh.

Referenced by vcsn::zipped_maps< Dereference, Maps >::iterator::done_().

template<typename Dereference = as_tuple, typename... Maps>
bool vcsn::zipped_maps< Dereference, Maps >::iterator::is_done_

Whether we reached the end.

Definition at line 81 of file zip-maps.hh.

template<typename Dereference = as_tuple, typename... Maps>
zipped_maps& vcsn::zipped_maps< Dereference, Maps >::iterator::zip_

The maps etc.

Definition at line 74 of file zip-maps.hh.


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