MySQL 9.6.0
Source Code Documentation
mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp > Class Template Reference

View over an even-length sequence, yielding the disjoint, adjacent pairs of elements. More...

#include <disjoint_pairs.h>

Inheritance diagram for mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >:
[legend]

Public Types

using Source_t = Source_tp
 
using Make_pair_t = Make_pair_tp
 
using Source_iterator_t = mysql::ranges::Range_iterator_type< Source_t >
 
using Source_const_iterator_t = mysql::ranges::Range_const_iterator_type< Source_t >
 
using Iterator_t = Disjoint_pairs_iterator< Source_iterator_t, Make_pair_t >
 
using Const_iterator_t = Disjoint_pairs_iterator< Source_const_iterator_t, Make_pair_t >
 
- Public Types inherited from mysql::ranges::Disjoint_pairs_interface< Disjoint_pairs_view< Source_tp, detail::Make_pair >, detail::Make_pair >
using Make_pair_t = detail::Make_pair
 

Public Member Functions

 Disjoint_pairs_view ()=default
 
 Disjoint_pairs_view (const Source_t &source)
 Construct a view that over the given source. More...
 
 Disjoint_pairs_view (const Disjoint_pairs_view &)=default
 
 Disjoint_pairs_view (Disjoint_pairs_view &&)=default
 
Disjoint_pairs_viewoperator= (const Disjoint_pairs_view &)=default
 
Disjoint_pairs_viewoperator= (Disjoint_pairs_view &&)=default
 
 ~Disjoint_pairs_view ()=default
 
const Source_tdisjoint_pairs_source () const
 Return const reference to the source. More...
 
- Public Member Functions inherited from mysql::ranges::Disjoint_pairs_interface< Disjoint_pairs_view< Source_tp, detail::Make_pair >, detail::Make_pair >
auto begin () const
 Return const iterator to the beginning. More...
 
auto begin ()
 Return iterator to the beginning. More...
 
auto end () const
 Return const iterator to sentinel. More...
 
auto end ()
 Return iterator to sentinel. More...
 
bool empty () const
 Return true if the range is empty. More...
 
bool empty () const
 Return true if the range is empty. More...
 
auto size () const
 Return the number of pairs, i.e., half the size of the source. More...
 
auto size () const
 Return the number of pairs, i.e., half the size of the source. More...
 
- Public Member Functions inherited from mysql::ranges::Collection_interface< Self_tp >
constexpr auto cbegin () const
 Return constant iterator to the beginning. More...
 
constexpr auto cend () const
 Return constant iterator to the end. More...
 
constexpr auto rbegin ()
 Return reverse iterator to the beginning. More...
 
constexpr auto rend ()
 Return reverse iterator to the end. More...
 
constexpr auto rbegin () const
 Return const reverse iterator to the beginning. More...
 
constexpr auto rend () const
 Return const reverse iterator to the end. More...
 
constexpr auto crbegin () const
 Return const reverse iterator to the beginning. More...
 
constexpr auto crend () const
 Return const reverse iterator to the end. More...
 
constexpr bool empty () const
 Return true if the range is empty, i.e., begin() == end(). More...
 
constexpr operator bool () const
 Return true if the range is non-empty, i.e., begin() != end(). More...
 
constexpr bool operator! () const
 Return true if the range is empty, i.e., begin() == end(). More...
 
constexpr auto size () const
 Return the number of elements in this view, unsigned (size_t), by computing std::ranges::distance(begin, end) More...
 
constexpr auto ssize () const
 Return the number of elements in this view, signed (ptrdiff_t). More...
 
constexpr decltype(auto) front () const
 Return the first element. More...
 
constexpr decltype(auto) back () const
 Return the last element. Enabled if we have bidirectional iterators. More...
 
constexpr decltype(auto) operator[] (std::ptrdiff_t n)
 Return the n'th element, possibly mutable. More...
 
constexpr decltype(auto) operator[] (std::ptrdiff_t n) const
 Return the n'th element, const. More...
 
constexpr auto * data ()
 Return pointer to underlying contiguous memory. More...
 
constexpr auto * data () const
 Return const pointer to underlying contiguous memory. More...
 

Private Types

using Source_ref_t = mysql::ranges::View_source< Source_tp >
 

Private Attributes

Source_ref_t m_source {}
 source, either owned or not. More...
 

Detailed Description

template<class Source_tp, class Make_pair_tp = detail::Make_pair>
class mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >

View over an even-length sequence, yielding the disjoint, adjacent pairs of elements.

For example, if the source sequence is 2, 3, 5, 7, 11, 13, then this yields the pairs <2,3>, <5,7>, <11,13>. It is conceptually similar to std::stride_view<std::slide_view<Source_tp>>, except the window width is defined at compile time and each window is wrapped in an object.

This a view, which does not own the source. If you need to define a class that owns the source, use Disjoint_pairs_interface.

Template Parameters
Source_tpRange that this is a view over. It must have the member functions begin, end, empty, and size. The distance between begin and end must be even.
Make_pair_tpClass containing a static member function make_pair that defines how to construct a pair from two adjacent elements. By default, uses detail::Make_pair, for which make_pair constructs and returns a std::pair object.

Member Typedef Documentation

◆ Const_iterator_t

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
using mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Const_iterator_t = Disjoint_pairs_iterator<Source_const_iterator_t, Make_pair_t>

◆ Iterator_t

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
using mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Iterator_t = Disjoint_pairs_iterator<Source_iterator_t, Make_pair_t>

◆ Make_pair_t

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
using mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Make_pair_t = Make_pair_tp

◆ Source_const_iterator_t

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
using mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Source_const_iterator_t = mysql::ranges::Range_const_iterator_type<Source_t>

◆ Source_iterator_t

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
using mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Source_iterator_t = mysql::ranges::Range_iterator_type<Source_t>

◆ Source_ref_t

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
using mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Source_ref_t = mysql::ranges::View_source<Source_tp>
private

◆ Source_t

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
using mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Source_t = Source_tp

Constructor & Destructor Documentation

◆ Disjoint_pairs_view() [1/4]

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Disjoint_pairs_view ( )
default

◆ Disjoint_pairs_view() [2/4]

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Disjoint_pairs_view ( const Source_t source)
inlineexplicit

Construct a view that over the given source.

The caller must ensure that the source outlives this object.

◆ Disjoint_pairs_view() [3/4]

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Disjoint_pairs_view ( const Disjoint_pairs_view< Source_tp, Make_pair_tp > &  )
default

◆ Disjoint_pairs_view() [4/4]

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::Disjoint_pairs_view ( Disjoint_pairs_view< Source_tp, Make_pair_tp > &&  )
default

◆ ~Disjoint_pairs_view()

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::~Disjoint_pairs_view ( )
default

Member Function Documentation

◆ disjoint_pairs_source()

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
const Source_t & mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::disjoint_pairs_source ( ) const
inline

Return const reference to the source.

◆ operator=() [1/2]

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
Disjoint_pairs_view & mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::operator= ( const Disjoint_pairs_view< Source_tp, Make_pair_tp > &  )
default

◆ operator=() [2/2]

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
Disjoint_pairs_view & mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::operator= ( Disjoint_pairs_view< Source_tp, Make_pair_tp > &&  )
default

Member Data Documentation

◆ m_source

template<class Source_tp , class Make_pair_tp = detail::Make_pair>
Source_ref_t mysql::ranges::Disjoint_pairs_view< Source_tp, Make_pair_tp >::m_source {}
private

source, either owned or not.


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