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 886 of file MemoryX.h.

Member Typedef Documentation

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

Definition at line 887 of file MemoryX.h.

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

Definition at line 888 of file MemoryX.h.

Constructor & Destructor Documentation

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

Definition at line 890 of file MemoryX.h.

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

Definition at line 893 of file MemoryX.h.

894  : 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 959 of file MemoryX.h.

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

961  {},
962  Unary unary_op = {}
963  ) const
964  {
965  R result = init;
966  for (auto&& v : *this)
967  result = binary_op(result, unary_op(v));
968  return result;
969  }
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 978 of file MemoryX.h.

References IteratorRange< Iterator >::accumulate().

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

Definition at line 935 of file MemoryX.h.

References IteratorRange< Iterator >::any_of().

936  {
937  auto notF =
938  [&](typename std::iterator_traits<Iterator>::reference v)
939  { return !f(v); };
940  return !this->any_of( notF );
941  }
bool any_of(const F &f) const
Definition: MemoryX.h:943
template<typename Iterator>
template<typename F >
bool IteratorRange< Iterator >::any_of ( const F &  f) const
inline

Definition at line 943 of file MemoryX.h.

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

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

944  { return this->end() != this->find_if(f); }
iterator find_if(const F &f) const
Definition: MemoryX.h:923
Iterator end() const
Definition: MemoryX.h:900
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 920 of file MemoryX.h.

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

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

Definition at line 905 of file MemoryX.h.

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

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

905 { return this->begin() == this->end(); }
Iterator begin() const
Definition: MemoryX.h:899
Iterator end() const
Definition: MemoryX.h:900
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 909 of file MemoryX.h.

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

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

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

Definition at line 923 of file MemoryX.h.

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

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

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

Definition at line 912 of file MemoryX.h.

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

913  {
914  auto iter = this->find(t);
915  if (iter == this->end())
916  return -1;
917  return std::distance(this->begin(), iter);
918  }
iterator find(const T &t) const
Definition: MemoryX.h:909
Iterator begin() const
Definition: MemoryX.h:899
Iterator end() const
Definition: MemoryX.h:900
template<typename Iterator>
template<typename F >
long IteratorRange< Iterator >::index_if ( const F &  f) const
inline

Definition at line 926 of file MemoryX.h.

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

927  {
928  auto iter = this->find_if(f);
929  if (iter == this->end())
930  return -1;
931  return std::distance(this->begin(), iter);
932  }
iterator find_if(const F &f) const
Definition: MemoryX.h:923
Iterator begin() const
Definition: MemoryX.h:899
Iterator end() const
Definition: MemoryX.h:900
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 1014 of file MemoryX.h.

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

1014  {} ) const
1015  {
1016  return this->accumulate(
1017  -std::numeric_limits< R >::max(),
1018  // std::numeric_limits< R >::lowest(), // TODO C++11
1019  (const R&(*)(const R&, const R&)) std::max,
1020  unary_op
1021  );
1022  }
R accumulate(R init, Binary binary_op={}, Unary unary_op={}) const
Definition: MemoryX.h:959
template<typename Iterator>
template<typename R2 , typename C , typename R = R2>
R IteratorRange< Iterator >::max ( R2(C::*)() const  pmf) const
inline

Definition at line 1028 of file MemoryX.h.

References IteratorRange< Iterator >::max().

1029  {
1030  return this->max( std::mem_fun( pmf ) );
1031  }
R max(Unary unary_op={}) const
Definition: MemoryX.h:1014
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 992 of file MemoryX.h.

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

992  {} ) const
993  {
994  return this->accumulate(
995  std::numeric_limits< R >::max(),
996  (const R&(*)(const R&, const R&)) std::min,
997  unary_op
998  );
999  }
R accumulate(R init, Binary binary_op={}, Unary unary_op={}) const
Definition: MemoryX.h:959
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 1005 of file MemoryX.h.

References IteratorRange< Iterator >::min().

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

Definition at line 946 of file MemoryX.h.

References IteratorRange< Iterator >::any_of().

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

Definition at line 906 of file MemoryX.h.

References IteratorRange< Iterator >::empty().

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

Definition at line 902 of file MemoryX.h.

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

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

Definition at line 903 of file MemoryX.h.

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

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

Definition at line 896 of file MemoryX.h.

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

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

Definition at line 907 of file MemoryX.h.

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

907 { return std::distance(this->begin(), this->end()); }
Iterator begin() const
Definition: MemoryX.h:899
Iterator end() const
Definition: MemoryX.h:900
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 1037 of file MemoryX.h.

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

1037  {} ) const
1038  {
1039  return this->accumulate(
1040  R{ 0 },
1041  std::plus< R >{},
1042  unary_op
1043  );
1044  }
R accumulate(R init, Binary binary_op={}, Unary unary_op={}) const
Definition: MemoryX.h:959
template<typename Iterator>
template<typename R2 , typename C , typename R = R2>
R IteratorRange< Iterator >::sum ( R2(C::*)() const  pmf) const
inline

Definition at line 1050 of file MemoryX.h.

References IteratorRange< Iterator >::sum().

1051  {
1052  return this->sum( std::mem_fun( pmf ) );
1053  }
R sum(Unary unary_op={}) const
Definition: MemoryX.h:1037

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