7 #include <dune/common/tuplevector.hh> 8 #include <amdis/common/Apply.hpp> 25 template <
class F,
class T>
26 auto map(F&& f, T
const& t)
39 static auto impl(F&& f, T
const& t)
45 template <
class T, std::
size_t n>
49 static auto impl(F&& f, std::array<T,n>
const& a)
51 return Ranges::applyIndices<n>([&](
auto... ii) {
52 return std::array{Recursive::map(f,a[ii])...}; });
56 template <
class... TT>
60 static auto impl(F&& f, std::tuple<TT...>
const& t)
62 return Ranges::apply([&](
auto const&... ti) {
63 return std::tuple{Recursive::map(f,ti)...}; }, t);
67 template <
class T1,
class T2>
71 static auto impl(F&& f, std::pair<T1,T2>
const& t)
73 return std::pair{Recursive::map(f,t.first), Recursive::map(f,t.second)};
77 template <
class... TT>
78 struct Map<Dune::TupleVector<TT...>>
81 static auto impl(F&& f, Dune::TupleVector<TT...>
const& t)
83 return Ranges::apply([&](
auto const&... ti) {
84 return Dune::makeTupleVector(Recursive::map(f,ti)...); }, t);
92 static auto impl(F&& f, std::vector<T>
const& v)
94 using U = TYPEOF(Recursive::map(f,std::declval<T>()));
96 out.reserve(v.size());
97 for (std::size_t i = 0; i < v.size(); ++i)
98 out.emplace_back(Recursive::map(f,v[i]));
Definition: FieldMatVec.hpp:12
Definition: AdaptBase.hpp:6
Default implementation of the recursive map function.
Definition: Map.hpp:14