MySQL 9.1.0
Source Code Documentation
Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map > Class Template Reference

Iterator that provides the elements of a nested map as a linear sequence. More...

#include <rpl_msr.h>

Public Types

using value_type = decltype(mapped_value(Inner_iterator_t()))
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

 Denested_map_iterator ()=default
 Default constructor. More...
 
constexpr Denested_map_iterator (const Outer_iterator_t &outer_begin, const Outer_iterator_t &outer_end, bool at_end)
 Constructor. More...
 
constexpr Self_toperator++ ()
 Pre-increment. More...
 
constexpr Self_t operator++ (int)
 Post-increment. More...
 
constexpr decltype(auto) operator* () const
 Dereference. More...
 
constexpr bool operator== (const Self_t &other) const
 Comparison. More...
 

Private Types

using Self_t = Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >
 
using Inner_map_t = decltype(mapped_value(Outer_iterator_t()))
 
using Inner_iterator_t = Iterator_for< Inner_map_t >
 

Private Member Functions

constexpr void skip_inner_end_positions ()
 Maintain the invariant that either m_outer_it points to the end, or m_inner_it doesn't point to the end. More...
 

Static Private Member Functions

static auto & mapped_value (const Outer_iterator_t &outer_iterator)
 
static auto & mapped_value (const Inner_iterator_t &inner_iterator)
 

Private Attributes

Outer_iterator_t m_outer_begin {}
 Beginning of outer map. More...
 
Outer_iterator_t m_outer_end {}
 End of outer map. More...
 
Outer_iterator_t m_outer_it {}
 Iterator to the outer map. More...
 
Inner_iterator_t m_inner_it {}
 Iterator to the inner map, or undefined if the outer map points to the end. More...
 

Detailed Description

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
class Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >

Iterator that provides the elements of a nested map as a linear sequence.

This satisfies std::forward_iterator.

Template Parameters
Outer_iterator_tForward iterator over the outer map.
outer_is_mapIf true, the outer map iterator yields pairs, and the second component of each pair contains the inner map. If false, the outer map iterator yields inner maps directly.
inner_is_mapIf true, the inner map iterator yields pairs, and the second component of each pair contains the value. If false, the inner map iterator yields values directly.

Member Typedef Documentation

◆ difference_type

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
using Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::difference_type = std::ptrdiff_t

◆ Inner_iterator_t

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
using Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::Inner_iterator_t = Iterator_for<Inner_map_t>
private

◆ Inner_map_t

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
using Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::Inner_map_t = decltype(mapped_value(Outer_iterator_t()))
private

◆ Self_t

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
using Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::Self_t = Denested_map_iterator<Outer_iterator_t, outer_is_map, inner_is_map>
private

◆ value_type

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
using Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::value_type = decltype(mapped_value(Inner_iterator_t()))

Constructor & Destructor Documentation

◆ Denested_map_iterator() [1/2]

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::Denested_map_iterator ( )
default

Default constructor.

The result is an object that is useless in itself since all member functions are undefined. It can be assigned or moved to, and it is required for iterators to be default-constructible.

◆ Denested_map_iterator() [2/2]

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
constexpr Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::Denested_map_iterator ( const Outer_iterator_t &  outer_begin,
const Outer_iterator_t &  outer_end,
bool  at_end 
)
inlineexplicitconstexpr

Constructor.

Parameters
outer_beginIterator to the first element of the nested map.
outer_endIterator to the one-past-the-last element of the nested map.
at_endIf true, position at the end; if false, position at the beginning.

Member Function Documentation

◆ mapped_value() [1/2]

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
static auto & Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::mapped_value ( const Inner_iterator_t inner_iterator)
inlinestaticprivate
Returns
Reference to the value that the given inner iterator points to, taking the 'second' element of the pair in case the inner iterator is a map.

◆ mapped_value() [2/2]

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
static auto & Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::mapped_value ( const Outer_iterator_t &  outer_iterator)
inlinestaticprivate
Returns
Reference to the container that the given outer iterator points to, taking the 'second' element of the pair in case the outer iterator is a map.

◆ operator*()

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
constexpr decltype(auto) Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::operator* ( ) const
inlineconstexpr

Dereference.

◆ operator++() [1/2]

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
constexpr Self_t & Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::operator++ ( )
inlineconstexpr

Pre-increment.

◆ operator++() [2/2]

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
constexpr Self_t Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::operator++ ( int  )
inlineconstexpr

Post-increment.

◆ operator==()

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
constexpr bool Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::operator== ( const Self_t other) const
inlineconstexpr

Comparison.

◆ skip_inner_end_positions()

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
constexpr void Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::skip_inner_end_positions ( )
inlineconstexprprivate

Maintain the invariant that either m_outer_it points to the end, or m_inner_it doesn't point to the end.

This may moves the iterators forward until the condition is met.

Member Data Documentation

◆ m_inner_it

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
Inner_iterator_t Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::m_inner_it {}
private

Iterator to the inner map, or undefined if the outer map points to the end.

◆ m_outer_begin

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
Outer_iterator_t Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::m_outer_begin {}
private

Beginning of outer map.

◆ m_outer_end

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
Outer_iterator_t Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::m_outer_end {}
private

End of outer map.

◆ m_outer_it

template<std::forward_iterator Outer_iterator_t, bool outer_is_map, bool inner_is_map>
Outer_iterator_t Denested_map_iterator< Outer_iterator_t, outer_is_map, inner_is_map >::m_outer_it {}
private

Iterator to the outer map.


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