From a991f62839d399f9b1220a6b96ec05463d560d9b Mon Sep 17 00:00:00 2001 From: Jorrit Fahlke <joe@dune-project.org> Date: Fri, 30 Jul 2010 21:35:54 +0000 Subject: [PATCH] [Dune::At] Make it work with native tuples (C++0x). [[Imported from SVN: r6071]] --- dune/common/utility.hh | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/dune/common/utility.hh b/dune/common/utility.hh index 1083cace6..518518cad 100644 --- a/dune/common/utility.hh +++ b/dune/common/utility.hh @@ -500,24 +500,20 @@ namespace Dune { struct At { - template<typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9> - static typename TupleAccessTraits< - typename tuple_element<tuple_size<tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> >::value - N - 1, - tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> >::type>::NonConstType - get(tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9>& t) + template<typename Tuple> + static + typename TupleAccessTraits<typename AtType<N, Tuple>::Type>::NonConstType + get(Tuple& t) { - return Dune::get<tuple_size<tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> >::value - N - 1>(t); + return Dune::get<tuple_size<Tuple>::value - N - 1>(t); } - template<typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9> - static typename TupleAccessTraits< - typename tuple_element<tuple_size<tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> >::value - N - 1, - tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> >::type>::ConstType - get(const tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9>& t) + template<typename Tuple> + static + typename TupleAccessTraits<typename AtType<N, Tuple>::Type>::ConstType + get(const Tuple& t) { - return Dune::get<tuple_size<tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> >::value - N - 1>(t); + return Dune::get<tuple_size<Tuple>::value - N - 1>(t); } }; -- GitLab