/usr/include/dune/common/std/utility.hh is in libdune-common-dev 2.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | #ifndef DUNE_COMMON_STD_UTILITY_HH
#define DUNE_COMMON_STD_UTILITY_HH
#include <cstddef>
#include <type_traits>
#include <utility>
#include <dune/common/typetraits.hh>
namespace Dune
{
namespace Std
{
#if __cpp_lib_integer_sequence >= 201304
using std::integer_sequence;
using std::index_sequence;
using std::make_integer_sequence;
using std::make_index_sequence;
#else // __cpp_lib_integer_sequence >= 201304
// integer_sequence
// ----------------
/** \brief an implementation of std::integer_sequence as introduced in C++14
*
* \tparam T an integer type
* \tparam ...Ints a non-type parameter pack
*/
template< class T, T... Ints >
class integer_sequence
{
static_assert( std::is_integral< T >::value, "Template parameter T is required to be an integral type" );
public:
/** \brief value type */
typedef T value_type;
/** \brief return number of elements in sequence */
static constexpr std::size_t size () { return sizeof...( Ints ); }
};
/** \brief std::index_sequence as introduced in C++14
*
* \tparam ...Ints a non-type parameter pack
*/
template< std::size_t... Ints >
using index_sequence = integer_sequence< std::size_t, Ints... >;
#ifndef DOXYGEN
namespace impl {
template<typename T, T i, T n, T... indices>
struct _make_integer_sequence
: public _make_integer_sequence<T,i+1,n,indices...,i>
{};
template<typename T, T n, T... indices>
struct _make_integer_sequence<T,n,n,indices...>
{
using type = integer_sequence<T,indices...>;
};
}
#endif // DOXYGEN
template<typename T, T n>
using make_integer_sequence = typename impl::_make_integer_sequence<T,0,n>::type;
template<std::size_t n>
using make_index_sequence = make_integer_sequence<std::size_t,n>;
#endif // __cpp_lib_integer_sequence >= 201304
/**
* \brief Create index_sequence from 0 to sizeof...(T)-1
*
* This should do the same as std::index_sequence_for.
* But due to a bug in the sizeof... operator this
* may produce wrong results with clang<3.8.
*
* As a workaround we provide our own implementation
* that avoids this bug even if the std:: version
* exists.
*
* This implemenation can be dropped, once we require
* a minimum clang version that has this bug fixed (i.e. >=3.8).
*/
template<typename... T>
using index_sequence_for = make_index_sequence<typename Dune::SizeOf<T...>{}>;
} // namespace Std
} // namespace Dune
#endif // #ifndef DUNE_COMMON_STD_UTILITY_HH
|