Skip to content
Snippets Groups Projects
Commit 6808d5cd authored by Carsten Gräser's avatar Carsten Gräser
Browse files

[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
parent a56767de
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment