5#ifndef DUNE_COMMON_TUPLEVECTOR_HH
6#define DUNE_COMMON_TUPLEVECTOR_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...>;
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)>
Traits for type conversions and type information.
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
constexpr auto makeTupleVector(T &&... t)
Definition tuplevector.hh:108
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 decltype(auto) operator[](const Dune::index_constant< i > &) const
Const access to the tuple elements.
Definition tuplevector.hh:61
constexpr decltype(auto) operator[](const Dune::index_constant< i > &)
Non-const access to the tuple elements.
Definition tuplevector.hh:70
constexpr TupleVector()
Default constructor.
Definition tuplevector.hh:54
typename std::tuple_element< i, std::tuple< Args... > >::type type
Definition tuplevector.hh:128