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

Short circuit Hybrid::forEach for integer_sequence

This reduced the template instanciation depth drastically.
For range=integer_sequence<21> is changes from 319 to 84.
parent 01c9b3bd
No related branches found
No related tags found
No related merge requests found
......@@ -262,6 +262,13 @@ namespace Impl {
evaluateFoldExpression<int>({(f(Hybrid::elementAt(range, std::integral_constant<Index,i>())), 0)...});
}
template<class F, class Index, Index... i>
constexpr void forEach(std::integer_sequence<Index, i...> range, F&& f, PriorityTag<2>)
{
evaluateFoldExpression<int>({(f(std::integral_constant<Index,i>()), 0)...});
}
template<class Range, class F,
std::enable_if_t<IsIntegralConstant<decltype(Hybrid::size(std::declval<Range>()))>::value, int> = 0>
constexpr void forEach(Range&& range, F&& f, PriorityTag<1>)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment