dune-common  2.6-git
Namespaces | Classes | Typedefs | Functions | Variables
Range Utilities

Utilities for reduction like operations on ranges. More...

Collaboration diagram for Range Utilities:

Namespaces

 Dune
 Dune namespace.
 

Classes

class  Dune::IntegralRange< T >
 dynamic integer range for use in range-based for loops More...
 
class  Dune::StaticIntegralRange< T, to, from >
 static integer range for use in range-based for loops More...
 

Typedefs

typedef T Dune::IntegralRange< T >::value_type
 type of integers contained in the range More...
 
typedef Impl::IntegralRangeIterator< T > Dune::IntegralRange< T >::iterator
 type of iterator More...
 
typedef std::make_unsigned_t< T > Dune::IntegralRange< T >::size_type
 unsigned integer type corresponding to value_type More...
 
typedef T Dune::StaticIntegralRange< T, to, from >::value_type
 type of integers contained in the range More...
 
typedef Impl::IntegralRangeIterator< T > Dune::StaticIntegralRange< T, to, from >::iterator
 type of iterator More...
 
typedef std::make_unsigned_t< T > Dune::StaticIntegralRange< T, to, from >::size_type
 unsigned integer type corresponding to value_type More...
 
typedef decltype(shift_integer_sequence< from >(std::make_integer_sequence< T, to-from >())) typedef Dune::StaticIntegralRange< T, to, from >::integer_sequence
 type of corresponding std::integer_sequence More...
 

Functions

template<typename T , typename std::enable_if< is_range< T >::value, int >::type = 0>
T::value_type Dune::max_value (const T &v)
 compute the maximum value over a range More...
 
template<typename T , typename std::enable_if< is_range< T >::value, int >::type = 0>
T::value_type Dune::min_value (const T &v)
 compute the minimum value over a range More...
 
template<typename T , typename std::enable_if< is_range< T >::value, int >::type = 0>
bool Dune::any_true (const T &v)
 similar to std::bitset<N>::any() return true, if any entries is true More...
 
template<std::size_t N>
bool Dune::any_true (const std::bitset< N > &b)
 
template<typename T , typename std::enable_if< is_range< T >::value, int >::type = 0>
bool Dune::all_true (const T &v)
 similar to std::bitset<N>::all() return true, if any entries is true More...
 
template<std::size_t N>
bool Dune::all_true (const std::bitset< N > &b)
 
constexpr Dune::IntegralRange< T >::IntegralRange (value_type from, value_type to) noexcept
 construct integer range [from, to) More...
 
constexpr Dune::IntegralRange< T >::IntegralRange (value_type to) noexcept
 construct integer range [0, to) More...
 
constexpr Dune::IntegralRange< T >::IntegralRange (std::pair< value_type, value_type > range) noexcept
 construct integer range std::pair More...
 
constexpr iterator Dune::IntegralRange< T >::begin () const noexcept
 obtain a random-access iterator to the first element More...
 
constexpr iterator Dune::IntegralRange< T >::end () const noexcept
 obtain a random-access iterator past the last element More...
 
constexpr value_type Dune::IntegralRange< T >::operator[] (const value_type &i) const noexcept
 access specified element More...
 
constexpr bool Dune::IntegralRange< T >::empty () const noexcept
 check whether the range is empty More...
 
constexpr size_type Dune::IntegralRange< T >::size () const noexcept
 obtain number of elements in the range More...
 
constexpr Dune::StaticIntegralRange< T, to, from >::StaticIntegralRange () noexcept=default
 default constructor More...
 
constexpr Dune::StaticIntegralRange< T, to, from >::operator IntegralRange< T > () const noexcept
 cast into dynamic IntegralRange More...
 
constexpr Dune::StaticIntegralRange< T, to, from >::operator integer_sequence () const noexcept
 cast into corresponding std::integer_sequence More...
 
static constexpr iterator Dune::StaticIntegralRange< T, to, from >::begin () noexcept
 obtain a random-access iterator to the first element More...
 
static constexpr iterator Dune::StaticIntegralRange< T, to, from >::end () noexcept
 obtain a random-access iterator past the last element More...
 
template<class U , U i>
constexpr auto Dune::StaticIntegralRange< T, to, from >::operator[] (const std::integral_constant< U, i > &) const noexcept -> std::integral_constant< value_type, from+static_cast< value_type >(i)>
 access specified element (static version) More...
 
constexpr value_type Dune::StaticIntegralRange< T, to, from >::operator[] (const size_type &i) const noexcept
 access specified element (dynamic version) More...
 
static constexpr std::integral_constant< bool, from==to > Dune::StaticIntegralRange< T, to, from >::empty () noexcept
 check whether the range is empty More...
 
static constexpr std::integral_constant< size_type, static_cast< size_type >to) - static_cast< size_type >from) > Dune::StaticIntegralRange< T, to, from >::size () noexcept
 obtain number of elements in the range More...
 
template<class T , class U , std::enable_if_t< std::is_same< std::decay_t< T >, std::decay_t< U >>::value, int > = 0, std::enable_if_t< std::is_integral< std::decay_t< T >>::value, int > = 0>
static IntegralRange< std::decay_t< T > > Dune::range (T &&from, U &&to) noexcept
 free standing function for setting up a range based for loop over an integer range for (auto i: range(0,10)) // 0,1,2,3,4,5,6,7,8,9 or for (auto i: range(-10,10)) // -10,-9,..,8,9 or for (auto i: range(10)) // 0,1,2,3,4,5,6,7,8,9 More...
 
template<class T , std::enable_if_t< std::is_integral< std::decay_t< T >>::value, int > = 0>
static IntegralRange< std::decay_t< T > > Dune::range (T &&to) noexcept
 
template<class T , T to>
static StaticIntegralRange< T, to > Dune::range (std::integral_constant< T, to >) noexcept
 

Variables

template<class T , T from, T to>
static StaticIntegralRange< T, to, from > Dune::range (std::integral_constant< T, from >, std::integral_constant< T, to >) noexcept
 

Detailed Description

Utilities for reduction like operations on ranges.

All these reduction operations work for appropriate ranges and scalar values

Typedef Documentation

◆ integer_sequence

template<class T , T to, T from = 0>
decltype(shift_integer_sequence<from>(std::make_integer_sequence<T, to-from>())) typedef Dune::StaticIntegralRange< T, to, from >::integer_sequence

type of corresponding std::integer_sequence

◆ iterator [1/2]

template<class T >
typedef Impl::IntegralRangeIterator<T> Dune::IntegralRange< T >::iterator

type of iterator

◆ iterator [2/2]

template<class T , T to, T from = 0>
typedef Impl::IntegralRangeIterator<T> Dune::StaticIntegralRange< T, to, from >::iterator

type of iterator

◆ size_type [1/2]

template<class T >
typedef std::make_unsigned_t<T> Dune::IntegralRange< T >::size_type

unsigned integer type corresponding to value_type

◆ size_type [2/2]

template<class T , T to, T from = 0>
typedef std::make_unsigned_t<T> Dune::StaticIntegralRange< T, to, from >::size_type

unsigned integer type corresponding to value_type

◆ value_type [1/2]

template<class T >
typedef T Dune::IntegralRange< T >::value_type

type of integers contained in the range

◆ value_type [2/2]

template<class T , T to, T from = 0>
typedef T Dune::StaticIntegralRange< T, to, from >::value_type

type of integers contained in the range

Function Documentation

◆ all_true() [1/2]

template<std::size_t N>
bool Dune::all_true ( const std::bitset< N > &  b)

◆ all_true() [2/2]

template<typename T , typename std::enable_if< is_range< T >::value, int >::type = 0>
bool Dune::all_true ( const T &  v)

similar to std::bitset<N>::all() return true, if any entries is true

overloads for scalar values, ranges, and std::bitset<N> exist

◆ any_true() [1/2]

template<std::size_t N>
bool Dune::any_true ( const std::bitset< N > &  b)

◆ any_true() [2/2]

template<typename T , typename std::enable_if< is_range< T >::value, int >::type = 0>
bool Dune::any_true ( const T &  v)

similar to std::bitset<N>::any() return true, if any entries is true

overloads for scalar values, ranges, and std::bitset<N> exist

◆ begin() [1/2]

template<class T >
constexpr iterator Dune::IntegralRange< T >::begin ( ) const
inlineconstexprnoexcept

obtain a random-access iterator to the first element

◆ begin() [2/2]

template<class T , T to, T from = 0>
static constexpr iterator Dune::StaticIntegralRange< T, to, from >::begin ( )
inlinestaticconstexprnoexcept

obtain a random-access iterator to the first element

◆ empty() [1/2]

template<class T >
constexpr bool Dune::IntegralRange< T >::empty ( ) const
inlineconstexprnoexcept

check whether the range is empty

◆ empty() [2/2]

template<class T , T to, T from = 0>
static constexpr std::integral_constant<bool, from == to> Dune::StaticIntegralRange< T, to, from >::empty ( )
inlinestaticconstexprnoexcept

check whether the range is empty

◆ end() [1/2]

template<class T >
constexpr iterator Dune::IntegralRange< T >::end ( ) const
inlineconstexprnoexcept

obtain a random-access iterator past the last element

◆ end() [2/2]

template<class T , T to, T from = 0>
static constexpr iterator Dune::StaticIntegralRange< T, to, from >::end ( )
inlinestaticconstexprnoexcept

obtain a random-access iterator past the last element

◆ IntegralRange() [1/3]

template<class T >
constexpr Dune::IntegralRange< T >::IntegralRange ( std::pair< value_type, value_type range)
inlineconstexprnoexcept

construct integer range std::pair

◆ IntegralRange() [2/3]

template<class T >
constexpr Dune::IntegralRange< T >::IntegralRange ( value_type  from,
value_type  to 
)
inlineconstexprnoexcept

construct integer range [from, to)

◆ IntegralRange() [3/3]

template<class T >
constexpr Dune::IntegralRange< T >::IntegralRange ( value_type  to)
inlineexplicitconstexprnoexcept

construct integer range [0, to)

◆ max_value()

template<typename T , typename std::enable_if< is_range< T >::value, int >::type = 0>
T::value_type Dune::max_value ( const T &  v)

compute the maximum value over a range

overloads for scalar values, and ranges exist

◆ min_value()

template<typename T , typename std::enable_if< is_range< T >::value, int >::type = 0>
T::value_type Dune::min_value ( const T &  v)

compute the minimum value over a range

overloads for scalar values, and ranges exist

◆ operator integer_sequence()

template<class T , T to, T from = 0>
constexpr Dune::StaticIntegralRange< T, to, from >::operator integer_sequence ( ) const
inlineconstexprnoexcept

cast into corresponding std::integer_sequence

◆ operator IntegralRange< T >()

template<class T , T to, T from = 0>
constexpr Dune::StaticIntegralRange< T, to, from >::operator IntegralRange< T > ( ) const
inlineconstexprnoexcept

cast into dynamic IntegralRange

◆ operator[]() [1/3]

template<class T , T to, T from = 0>
constexpr value_type Dune::StaticIntegralRange< T, to, from >::operator[] ( const size_type i) const
inlineconstexprnoexcept

access specified element (dynamic version)

◆ operator[]() [2/3]

template<class T , T to, T from = 0>
template<class U , U i>
constexpr auto Dune::StaticIntegralRange< T, to, from >::operator[] ( const std::integral_constant< U, i > &  ) const -> std::integral_constant<value_type, from + static_cast<value_type>(i)>
inlineconstexprnoexcept

access specified element (static version)

◆ operator[]() [3/3]

template<class T >
constexpr value_type Dune::IntegralRange< T >::operator[] ( const value_type i) const
inlineconstexprnoexcept

access specified element

◆ range() [1/3]

template<class T , T to>
static StaticIntegralRange<T, to> Dune::range ( std::integral_constant< T, to >  )
inlinestaticnoexcept

◆ range() [2/3]

template<class T , class U , std::enable_if_t< std::is_same< std::decay_t< T >, std::decay_t< U >>::value, int > = 0, std::enable_if_t< std::is_integral< std::decay_t< T >>::value, int > = 0>
static IntegralRange<std::decay_t<T> > Dune::range ( T &&  from,
U &&  to 
)
inlinestaticnoexcept

free standing function for setting up a range based for loop over an integer range for (auto i: range(0,10)) // 0,1,2,3,4,5,6,7,8,9 or for (auto i: range(-10,10)) // -10,-9,..,8,9 or for (auto i: range(10)) // 0,1,2,3,4,5,6,7,8,9

◆ range() [3/3]

template<class T , std::enable_if_t< std::is_integral< std::decay_t< T >>::value, int > = 0>
static IntegralRange<std::decay_t<T> > Dune::range ( T &&  to)
inlinestaticnoexcept

◆ size() [1/2]

template<class T >
constexpr size_type Dune::IntegralRange< T >::size ( ) const
inlineconstexprnoexcept

obtain number of elements in the range

◆ size() [2/2]

template<class T , T to, T from = 0>
static constexpr std::integral_constant<size_type, static_cast<size_type>to) - static_cast<size_type>from) > Dune::StaticIntegralRange< T, to, from >::size ( )
inlinestaticconstexprnoexcept

obtain number of elements in the range

◆ StaticIntegralRange()

template<class T , T to, T from = 0>
constexpr Dune::StaticIntegralRange< T, to, from >::StaticIntegralRange ( )
constexprdefaultnoexcept

default constructor

Variable Documentation

◆ range

template<class T , T from, T to>
StaticIntegralRange<T, to> Dune::range(std::integral_constant< T, to >) noexcept
inlinestaticnoexcept