From 6808d5cd73062e2de0acb0d6462c4cce0160d9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org> Date: Thu, 16 Jun 2016 16:14:03 +0200 Subject: [PATCH] [cleanup] Avoid unused variable warning We could cast the std::initializer_list to void to avoid the warning. But extracting this as a function makes the code more readable. Maybe evaluateFoldExpression() should be moved outside of Imp:: because this little trick nicely helps to avoid a template recursion --- dune/solvers/common/algorithm.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dune/solvers/common/algorithm.hh b/dune/solvers/common/algorithm.hh index 1c4a6593..ac43feb0 100644 --- a/dune/solvers/common/algorithm.hh +++ b/dune/solvers/common/algorithm.hh @@ -240,12 +240,14 @@ constexpr auto integralRange(const End& end) namespace Imp { + template<class T> + void evaluateFoldExpression(std::initializer_list<T>&&) + {} + template<class Range, class F, class Index, Index... i> constexpr void forEachIndex(Range&& range, F&& f, std::integer_sequence<Index, i...>) { - (void)std::initializer_list<int>{ - ((void)f(Hybrid::elementAt(range, std::integral_constant<Index,i>())), 0)... - }; + evaluateFoldExpression({(f(Hybrid::elementAt(range, std::integral_constant<Index,i>())), 0)...}); } template<class Range, class F, -- GitLab