1 #ifndef DUNE_COMMON_STD_UTILITY_HH
2 #define DUNE_COMMON_STD_UTILITY_HH
27 template<
class T, T... Ints >
30 static_assert( std::is_integral< T >::value,
"Template parameter T is required to be an integral type" );
41 #endif // #ifndef DOXYGEN
47 static DUNE_CONSTEXPR std::size_t size () {
return sizeof...( Ints ); }
60 template< std::size_t... Ints >
72 template< std::
size_t N >
73 class make_index_sequence_impl;
76 class make_index_sequence_impl< 0u >
83 class make_index_sequence_impl< 1u >
86 typedef index_sequence< 0 > type;
89 template< std::
size_t N >
90 class make_index_sequence_impl
92 static_assert( N >= 0,
"Cannot produce an index sequence of negative length" );
94 template< std::size_t... I1, std::size_t... I2 >
95 static index_sequence< I1..., (
sizeof...( I1 )+I2)... >
96 add ( index_sequence< I1... >, index_sequence< I2... > )
98 return index_sequence< I1..., (
sizeof...( I1 )+I2)... >();
102 typedef decltype( add(
typename make_index_sequence_impl< N/2 >::type(),
typename make_index_sequence_impl< N-N/2 >::type() ) ) type;
105 #endif // #ifndef DOXYGEN
119 template< std::
size_t N >
122 return typename make_index_sequence_impl< N >::type();
138 template<
class T, T N >
139 static DUNE_CONSTEXPR inline typename make_index_sequence_impl< N >::type::template rebind< T >::type
142 return typename make_index_sequence_impl< N >::type::template rebind< T >::type();
157 template<
class... T >
158 static DUNE_CONSTEXPR inline typename make_index_sequence_impl<
sizeof...( T ) >::type
161 return typename make_index_sequence_impl<
sizeof...( T ) >::type();
180 #endif // #ifndef DUNE_COMMON_STD_UTILITY_HH
a function similar to std::index_sequence to be introduced in C++14
Definition: utility.hh:61
#define DUNE_CONSTEXPR
Set method or expression constexpr if supported by the compiler.
Definition: constexpr.hh:21
static DUNE_CONSTEXPR make_index_sequence_impl< N >::type make_index_sequence()
a function similar to std::make_index_sequence to be introduced in C++14
Definition: utility.hh:120
an implementation of std::integer_sequence to be introduced in C++14
Definition: utility.hh:28
static DUNE_CONSTEXPR make_index_sequence_impl< N >::type::template rebind< T >::type make_integer_sequence()
a function similar to std::make_integer_sequence to be introduced in C++14
Definition: utility.hh:140
Definition of the DUNE_NOEXCEPT macro.
Dune namespace.
Definition: alignment.hh:9
std::add_rvalue_reference< T >::type declval() DUNE_NOEXCEPT
Definition of the DUNE_CONSTEXPR macro.
#define DUNE_NOEXCEPT
Set method to noexcept if supported by the compiler.
Definition: noexcept.hh:22
static DUNE_CONSTEXPR make_index_sequence_impl< sizeof...(T) >::type index_sequence_for()
a function similar to std::index_sequence_for to be introduced in C++14
Definition: utility.hh:159