5#ifndef DUNE_COMMON_TUPLEVECTOR_HH
6#define DUNE_COMMON_TUPLEVECTOR_HH
11#include <dune/common/indices.hh>
13#include <dune/common/std/type_traits.hh>
36 using Base = std::tuple<T...>;
47 class = std::void_t<decltype(Base(std::declval<TT&&>()...))>>
49 Base(std::forward<TT>(tt)...)
59 template<std::size_t i,
60 std::enable_if_t<(i <
sizeof...(T)),
int> = 0>
63 return std::get<i>(*
this);
68 template<std::size_t i,
69 std::enable_if_t<(i <
sizeof...(T)),
int> = 0>
72 return std::get<i>(*
this);
76 static constexpr std::size_t
size()
78 return std::tuple_size<Base>::value;
87TupleVector(T...) -> TupleVector<T...>;
89template<
class T1,
class T2>
90TupleVector(std::pair<T1, T2>) -> TupleVector<T1, T2>;
93TupleVector(std::tuple<T...>) -> TupleVector<T...>;
95template <
class Alloc,
class... T>
96TupleVector(std::allocator_arg_t, Alloc, T...) -> TupleVector<T...>;
98template<
class Alloc,
class T1,
class T2>
99TupleVector(std::allocator_arg_t, Alloc, std::pair<T1, T2>) -> TupleVector<T1, T2>;
101template<
class Alloc,
class... T>
102TupleVector(std::allocator_arg_t, Alloc, std::tuple<T...>) -> TupleVector<T...>;
108constexpr auto makeTupleVector(T&&... t)
112 return TupleVector<std::decay_t<T>...>(std::forward<T>(t)...);
125 template <
size_t i,
typename... Args>
126 struct tuple_element<i,
Dune::TupleVector<Args...> >
128 using type =
typename std::tuple_element<i, std::tuple<Args...> >::type;
135 template <
typename... Args>
136 struct tuple_size<
Dune::TupleVector<Args...> >
137 : std::integral_constant<std::size_t, sizeof...(Args)>
A class augmenting std::tuple by element access via operator[].
Definition: tuplevector.hh:35
static constexpr std::size_t size()
Number of elements of the tuple.
Definition: tuplevector.hh:76
constexpr TupleVector(TT &&... tt)
Construct from a set of arguments.
Definition: tuplevector.hh:48
constexpr TupleVector()
Default constructor.
Definition: tuplevector.hh:54
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition: indices.hh:29
Dune namespace.
Definition: alignedallocator.hh:13
Traits for type conversions and type information.