From 19935161c612fca4534002651dca08050ff2a1e3 Mon Sep 17 00:00:00 2001 From: Simon Praetorius Date: Wed, 1 May 2019 15:21:17 +0200 Subject: [PATCH 1/2] extend apply and for_each functions --- src/amdis/common/Apply.hpp | 7 +++++++ src/amdis/common/ForEach.hpp | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/amdis/common/Apply.hpp b/src/amdis/common/Apply.hpp index 21e2fef0..46073a01 100644 --- a/src/amdis/common/Apply.hpp +++ b/src/amdis/common/Apply.hpp @@ -41,6 +41,13 @@ namespace AMDiS return apply(FWD(f), std::forward_as_tuple(args...)); } + template + constexpr decltype(auto) apply_indices(Functor&& f) + { + return Impl_::apply_indices_impl(FWD(f), index_t<0>{}, + std::make_index_sequence{}); + } + template constexpr decltype(auto) apply_indices(Functor&& f, index_t) { diff --git a/src/amdis/common/ForEach.hpp b/src/amdis/common/ForEach.hpp index 7768a561..f64d6177 100644 --- a/src/amdis/common/ForEach.hpp +++ b/src/amdis/common/ForEach.hpp @@ -15,6 +15,17 @@ namespace AMDiS void ignored_evaluation(std::initializer_list&&) { /* do nothing */ } } + template + constexpr void for_variadic(Functor&& f, Args&&... args) + { + using std::get; +#if AMDIS_HAS_CXX_FOLD_EXPRESSIONS + (f(FWD(args)),...); +#else + Impl_::ignored_evaluation({0, (f(FWD(args)), 0)...}); +#endif + } + template constexpr void for_each(std::index_sequence, Tuple&& tuple, Functor&& f) { -- GitLab From 823cb0e4f5eee45aa4c7726cbdaf812e27da5801 Mon Sep 17 00:00:00 2001 From: Simon Praetorius Date: Fri, 3 May 2019 13:33:33 +0200 Subject: [PATCH 2/2] removed unused 'using' declaration --- src/amdis/common/ForEach.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/amdis/common/ForEach.hpp b/src/amdis/common/ForEach.hpp index f64d6177..1cbba6f8 100644 --- a/src/amdis/common/ForEach.hpp +++ b/src/amdis/common/ForEach.hpp @@ -18,7 +18,6 @@ namespace AMDiS template constexpr void for_variadic(Functor&& f, Args&&... args) { - using std::get; #if AMDIS_HAS_CXX_FOLD_EXPRESSIONS (f(FWD(args)),...); #else -- GitLab