Template Function t8_hidden_functions::unrolled_for_impl
Defined in File t8_unrolled_for.hxx
Function Documentation
-
template<std::size_t first, std::size_t last, typename TFunction>
constexpr void t8_hidden_functions::unrolled_for_impl(TFunction &&body) Implementation of a compile-time unrolled for.
Has 0 runtime overhead compared to normal loops. Index can be used in compile-time contexts like array length or template arguments.
Usage: int x = 1 unrolled_for<0, 3>([&](auto loop_count) { do_something<loop_count>(x); }; expands to: do_something<0>(x); do_something<1>(x); do_something<2>(x);
- Template Parameters:
first – Starting variable, has to be an integer
last – Ending variable, has to be an integer (last iteration is iter < last)
TFunction – Body of the for loop as a lambda function.
- Parameters:
body – [in] The body of the loop as a lambda function.