Audacity  2.2.2
Classes | Public Types | Public Member Functions | List of all members
IteratorRange< Iterator > Struct Template Reference

#include <MemoryX.h>

Inheritance diagram for IteratorRange< Iterator >:

Classes

struct  identity
 

Public Types

using iterator = Iterator
 
using reverse_iterator = std::reverse_iterator< Iterator >
 

Public Member Functions

 IteratorRange (const Iterator &a, const Iterator &b)
 
 IteratorRange (Iterator &&a, Iterator &&b)
 
IteratorRange< reverse_iteratorreversal () const
 
Iterator begin () const
 
Iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
bool empty () const
 
 operator bool () const
 
size_t size () const
 
template<typename T >
iterator find (const T &t) const
 
template<typename T >
long index (const T &t) const
 
template<typename T >
bool contains (const T &t) const
 
template<typename F >
iterator find_if (const F &f) const
 
template<typename F >
long index_if (const F &f) const
 
template<typename F >
bool all_of (const F &f) const
 
template<typename F >
bool any_of (const F &f) const
 
template<typename F >
bool none_of (const F &f) const
 
template<typename R , typename Binary = std::plus< R >, typename Unary = identity< decltype( *std::declval<Iterator>() ) >>
accumulate (R init, Binary binary_op={}, Unary unary_op={}) const
 
template<typename R , typename Binary = std::plus< R >, typename R2 , typename C >
accumulate (R init, Binary binary_op, R2(C::*pmf)() const ) const
 
template<typename Unary = identity< decltype( *std::declval<Iterator>() ) >, typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )>
min (Unary unary_op={}) const
 
template<typename R2 , typename C , typename R = R2>
min (R2(C::*pmf)() const ) const
 
template<typename Unary = identity< decltype( *std::declval<Iterator>() ) >, typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )>
max (Unary unary_op={}) const
 
template<typename R2 , typename C , typename R = R2>
max (R2(C::*pmf)() const ) const
 
template<typename Unary = identity< decltype( *std::declval<Iterator>() ) >, typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )>
sum (Unary unary_op={}) const
 
template<typename R2 , typename C , typename R = R2>
sum (R2(C::*pmf)() const ) const
 

Detailed Description

template<typename Iterator>
struct IteratorRange< Iterator >

Definition at line 907 of file MemoryX.h.

Member Typedef Documentation

template<typename Iterator>
using IteratorRange< Iterator >::iterator = Iterator

Definition at line 908 of file MemoryX.h.

template<typename Iterator>
using IteratorRange< Iterator >::reverse_iterator = std::reverse_iterator<Iterator>

Definition at line 909 of file MemoryX.h.

Constructor & Destructor Documentation

template<typename Iterator>
IteratorRange< Iterator >::IteratorRange ( const Iterator &  a,
const Iterator &  b 
)
inline

Definition at line 911 of file MemoryX.h.

912  : std::pair<Iterator, Iterator> ( a, b ) {}
template<typename Iterator>
IteratorRange< Iterator >::IteratorRange ( Iterator &&  a,
Iterator &&  b 
)
inline

Definition at line 914 of file MemoryX.h.

915  : std::pair<Iterator, Iterator> ( std::move(a), std::move(b) ) {}

Member Function Documentation

template<typename Iterator>
template<typename R , typename Binary = std::plus< R >, typename Unary = identity< decltype( *std::declval<Iterator>() ) >>
R IteratorRange< Iterator >::accumulate ( init,
Binary  binary_op = {},
Unary  unary_op = {} 
) const
inline

Definition at line 980 of file MemoryX.h.

Referenced by IteratorRange< Iterator >::accumulate().

982  {},
983  Unary unary_op = {}
984  ) const
985  {
986  R result = init;
987  for (auto&& v : *this)
988  result = binary_op(result, unary_op(v));
989  return result;
990  }
template<typename Iterator>
template<typename R , typename Binary = std::plus< R >, typename R2 , typename C >
R IteratorRange< Iterator >::accumulate ( init,
Binary  binary_op,
R2(C::*)() const  pmf 
) const
inline

Definition at line 999 of file MemoryX.h.

References IteratorRange< Iterator >::accumulate().

1004  {
1005  return this->accumulate( init, binary_op, std::mem_fun( pmf ) );
1006  }
R accumulate(R init, Binary binary_op={}, Unary unary_op={}) const
Definition: MemoryX.h:980
template<typename Iterator>
template<typename F >
bool IteratorRange< Iterator >::all_of ( const F &  f) const
inline

Definition at line 956 of file MemoryX.h.

References IteratorRange< Iterator >::any_of().

957  {
958  auto notF =
959  [&](typename std::iterator_traits<Iterator>::reference v)
960  { return !f(v); };
961  return !this->any_of( notF );
962  }
bool any_of(const F &f) const
Definition: MemoryX.h:964
template<typename Iterator>
template<typename F >
bool IteratorRange< Iterator >::any_of ( const F &  f) const
inline

Definition at line 964 of file MemoryX.h.

References IteratorRange< Iterator >::end(), and IteratorRange< Iterator >::find_if().

Referenced by IteratorRange< Iterator >::all_of(), and IteratorRange< Iterator >::none_of().

965  { return this->end() != this->find_if(f); }
iterator find_if(const F &f) const
Definition: MemoryX.h:944
Iterator end() const
Definition: MemoryX.h:921
template<typename Iterator>
Iterator IteratorRange< Iterator >::begin ( ) const
inline
template<typename Iterator>
template<typename T >
bool IteratorRange< Iterator >::contains ( const T &  t) const
inline

Definition at line 941 of file MemoryX.h.

References IteratorRange< Iterator >::end(), and IteratorRange< Iterator >::find().

942  { return this->end() != this->find(t); }
iterator find(const T &t) const
Definition: MemoryX.h:930
Iterator end() const
Definition: MemoryX.h:921
template<typename Iterator>
bool IteratorRange< Iterator >::empty ( ) const
inline

Definition at line 926 of file MemoryX.h.

References IteratorRange< Iterator >::begin(), and IteratorRange< Iterator >::end().

Referenced by IteratorRange< Iterator >::operator bool().

926 { return this->begin() == this->end(); }
Iterator begin() const
Definition: MemoryX.h:920
Iterator end() const
Definition: MemoryX.h:921
template<typename Iterator>
Iterator IteratorRange< Iterator >::end ( ) const
inline
template<typename Iterator>
template<typename T >
iterator IteratorRange< Iterator >::find ( const T &  t) const
inline

Definition at line 930 of file MemoryX.h.

References IteratorRange< Iterator >::begin(), and IteratorRange< Iterator >::end().

Referenced by IteratorRange< Iterator >::contains(), and IteratorRange< Iterator >::index().

931  { return std::find(this->begin(), this->end(), t); }
Iterator begin() const
Definition: MemoryX.h:920
Iterator end() const
Definition: MemoryX.h:921
template<typename Iterator>
template<typename F >
iterator IteratorRange< Iterator >::find_if ( const F &  f) const
inline

Definition at line 944 of file MemoryX.h.

References IteratorRange< Iterator >::begin(), and IteratorRange< Iterator >::end().

Referenced by IteratorRange< Iterator >::any_of(), and IteratorRange< Iterator >::index_if().

945  { return std::find_if(this->begin(), this->end(), f); }
Iterator begin() const
Definition: MemoryX.h:920
Iterator end() const
Definition: MemoryX.h:921
template<typename Iterator>
template<typename T >
long IteratorRange< Iterator >::index ( const T &  t) const
inline

Definition at line 933 of file MemoryX.h.

References IteratorRange< Iterator >::begin(), IteratorRange< Iterator >::end(), and IteratorRange< Iterator >::find().

934  {
935  auto iter = this->find(t);
936  if (iter == this->end())
937  return -1;
938  return std::distance(this->begin(), iter);
939  }
iterator find(const T &t) const
Definition: MemoryX.h:930
Iterator begin() const
Definition: MemoryX.h:920
Iterator end() const
Definition: MemoryX.h:921
template<typename Iterator>
template<typename F >
long IteratorRange< Iterator >::index_if ( const F &  f) const
inline

Definition at line 947 of file MemoryX.h.

References IteratorRange< Iterator >::begin(), IteratorRange< Iterator >::end(), and IteratorRange< Iterator >::find_if().

948  {
949  auto iter = this->find_if(f);
950  if (iter == this->end())
951  return -1;
952  return std::distance(this->begin(), iter);
953  }
iterator find_if(const F &f) const
Definition: MemoryX.h:944
Iterator begin() const
Definition: MemoryX.h:920
Iterator end() const
Definition: MemoryX.h:921
template<typename Iterator>
template<typename Unary = identity< decltype( *std::declval<Iterator>() ) >, typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )>
R IteratorRange< Iterator >::max ( Unary  unary_op = {}) const
inline

Definition at line 1035 of file MemoryX.h.

Referenced by IteratorRange< Iterator >::max().

1035  {} ) const
1036  {
1037  return this->accumulate(
1038  -std::numeric_limits< R >::max(),
1039  // std::numeric_limits< R >::lowest(), // TODO C++11
1040  (const R&(*)(const R&, const R&)) std::max,
1041  unary_op
1042  );
1043  }
R accumulate(R init, Binary binary_op={}, Unary unary_op={}) const
Definition: MemoryX.h:980
template<typename Iterator>
template<typename R2 , typename C , typename R = R2>
R IteratorRange< Iterator >::max ( R2(C::*)() const  pmf) const
inline

Definition at line 1049 of file MemoryX.h.

References IteratorRange< Iterator >::max().

1050  {
1051  return this->max( std::mem_fun( pmf ) );
1052  }
R max(Unary unary_op={}) const
Definition: MemoryX.h:1035
template<typename Iterator>
template<typename Unary = identity< decltype( *std::declval<Iterator>() ) >, typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )>
R IteratorRange< Iterator >::min ( Unary  unary_op = {}) const
inline

Definition at line 1013 of file MemoryX.h.

Referenced by IteratorRange< Iterator >::min().

1013  {} ) const
1014  {
1015  return this->accumulate(
1016  std::numeric_limits< R >::max(),
1017  (const R&(*)(const R&, const R&)) std::min,
1018  unary_op
1019  );
1020  }
R accumulate(R init, Binary binary_op={}, Unary unary_op={}) const
Definition: MemoryX.h:980
int min(int a, int b)
template<typename Iterator>
template<typename R2 , typename C , typename R = R2>
R IteratorRange< Iterator >::min ( R2(C::*)() const  pmf) const
inline

Definition at line 1026 of file MemoryX.h.

References IteratorRange< Iterator >::min().

1027  {
1028  return this->min( std::mem_fun( pmf ) );
1029  }
R min(Unary unary_op={}) const
Definition: MemoryX.h:1013
template<typename Iterator>
template<typename F >
bool IteratorRange< Iterator >::none_of ( const F &  f) const
inline

Definition at line 967 of file MemoryX.h.

References IteratorRange< Iterator >::any_of().

968  { return !this->any_of(f); }
bool any_of(const F &f) const
Definition: MemoryX.h:964
template<typename Iterator>
IteratorRange< Iterator >::operator bool ( ) const
inlineexplicit

Definition at line 927 of file MemoryX.h.

References IteratorRange< Iterator >::empty().

927 { return !this->empty(); }
bool empty() const
Definition: MemoryX.h:926
template<typename Iterator>
reverse_iterator IteratorRange< Iterator >::rbegin ( ) const
inline

Definition at line 923 of file MemoryX.h.

Referenced by IteratorRange< Iterator >::reversal().

923 { return reverse_iterator{ this->second }; }
std::reverse_iterator< Iterator > reverse_iterator
Definition: MemoryX.h:909
template<typename Iterator>
reverse_iterator IteratorRange< Iterator >::rend ( ) const
inline

Definition at line 924 of file MemoryX.h.

Referenced by IteratorRange< Iterator >::reversal().

924 { return reverse_iterator{ this->first }; }
std::reverse_iterator< Iterator > reverse_iterator
Definition: MemoryX.h:909
template<typename Iterator>
IteratorRange< reverse_iterator > IteratorRange< Iterator >::reversal ( ) const
inline

Definition at line 917 of file MemoryX.h.

References IteratorRange< Iterator >::rbegin(), and IteratorRange< Iterator >::rend().

918  { return { this->rbegin(), this->rend() }; }
reverse_iterator rend() const
Definition: MemoryX.h:924
reverse_iterator rbegin() const
Definition: MemoryX.h:923
template<typename Iterator>
size_t IteratorRange< Iterator >::size ( ) const
inline

Definition at line 928 of file MemoryX.h.

References IteratorRange< Iterator >::begin(), and IteratorRange< Iterator >::end().

928 { return std::distance(this->begin(), this->end()); }
Iterator begin() const
Definition: MemoryX.h:920
Iterator end() const
Definition: MemoryX.h:921
template<typename Iterator>
template<typename Unary = identity< decltype( *std::declval<Iterator>() ) >, typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )>
R IteratorRange< Iterator >::sum ( Unary  unary_op = {}) const
inline

Definition at line 1058 of file MemoryX.h.

Referenced by IteratorRange< Iterator >::sum().

1058  {} ) const
1059  {
1060  return this->accumulate(
1061  R{ 0 },
1062  std::plus< R >{},
1063  unary_op
1064  );
1065  }
R accumulate(R init, Binary binary_op={}, Unary unary_op={}) const
Definition: MemoryX.h:980
template<typename Iterator>
template<typename R2 , typename C , typename R = R2>
R IteratorRange< Iterator >::sum ( R2(C::*)() const  pmf) const
inline

Definition at line 1071 of file MemoryX.h.

References IteratorRange< Iterator >::sum().

1072  {
1073  return this->sum( std::mem_fun( pmf ) );
1074  }
R sum(Unary unary_op={}) const
Definition: MemoryX.h:1058

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