/usr/include/dune/common/tuplevector.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 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_COMMON_TUPLEVECTOR_HH
#define DUNE_COMMON_TUPLEVECTOR_HH
#include <tuple>
#include <utility>
#include <dune/common/indices.hh>
/**
* \file
* \brief Provides the TupleVector class that augments std::tuple by operator[]
* \author Carsten Gräser
*/
namespace Dune
{
/**
* \brief A class augmenting std::tuple by element access via operator[]
*
* \ingroup Utilities
*/
template<class... T>
class TupleVector : public std::tuple<T...>
{
using Base = std::tuple<T...>;
public:
/** \brief Construct from a set of arguments
*/
template<class... TT>
constexpr TupleVector(TT&&... tt) :
Base(std::forward<TT>(tt)...)
{}
/** \brief Default constructor
*/
constexpr TupleVector()
{}
/** \brief Const access to the tuple elements
*/
template<std::size_t i>
constexpr decltype(auto) operator[](const Dune::index_constant<i>&) const
{
return std::get<i>(*this);
}
/** \brief Non-const access to the tuple elements
*/
template<std::size_t i>
decltype(auto) operator[](const Dune::index_constant<i>&)
{
return std::get<i>(*this);
}
/** \brief Number of elements of the tuple */
static constexpr std::size_t size()
{
return std::tuple_size<Base>::value;
}
};
template<class... T>
constexpr auto makeTupleVector(T&&... t)
{
// The std::decay_t<T> is is a slight simplification,
// because std::reference_wrapper needs special care.
return TupleVector<std::decay_t<T>...>(std::forward<T>(t)...);
}
} // namespace Dune
#endif // DUNE_COMMON_TUPLEVECTOR_HH
|