dune-functions  2.6-dev
tuplevector.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_FUNCTIONS_COMMON_TUPLEVECTOR_HH
4 #define DUNE_FUNCTIONS_COMMON_TUPLEVECTOR_HH
5 
6 #include <tuple>
7 
8 #include <dune/common/indices.hh>
9 #include <dune/common/deprecated.hh>
10 
11 namespace Dune
12 {
13 namespace Functions
14 {
15 
21  template<class... T>
22  class DUNE_DEPRECATED_MSG("Dune::TupleVector form dune-common instead!")
23  TupleVector : public std::tuple<T...>
24  {
25  using Base = std::tuple<T...>;
26 
27  public:
28 
30  template<class... TT>
31  constexpr TupleVector(TT&&... tt) :
32  Base(std::forward<TT>(tt)...)
33  {}
34 
36  constexpr TupleVector()
37  {}
38 
40  template<std::size_t i>
41  auto operator[](const Dune::index_constant<i>&) const
42  ->decltype(std::get<i>(*this))
43  {
44  return std::get<i>(*this);
45  }
46 
48  template<std::size_t i>
49  auto operator[](const Dune::index_constant<i>&)
50  ->decltype(std::get<i>(*this))
51  {
52  return std::get<i>(*this);
53  }
54 
56  static constexpr std::size_t size()
57  {
58  return std::tuple_size<Base>::value;
59  }
60 
61  };
62 
63 } // namespace Functions
64 
65 } // namespace Dune
66 
67 #endif
constexpr TupleVector(TT &&... tt)
Construct from a set of arguments.
Definition: tuplevector.hh:31
auto operator[](const Dune::index_constant< i > &) -> decltype(std::get< i >(*this))
Non-const access to the tuple elements.
Definition: tuplevector.hh:49
A class augmenting std::tuple by element access via operator[].
Definition: tuplevector.hh:22
Definition: polynomial.hh:7
static constexpr std::size_t size()
Number of elements of the tuple.
Definition: tuplevector.hh:56
auto operator[](const Dune::index_constant< i > &) const -> decltype(std::get< i >(*this))
Const access to the tuple elements.
Definition: tuplevector.hh:41
constexpr TupleVector()
Default constructor.
Definition: tuplevector.hh:36
STL namespace.