Define unrolled_for

Define Documentation

unrolled_for(FIRST, LAST, ITER, 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, loop_index, { do_something<loop_index>(x); });

expands to:

do_something<0>(x); do_something<1>(x); do_something<2>(x);

Parameters:
  • FIRST[in] Starting variable, has to be an integer.

  • LAST[in] Ending variable, has to be an integer (last iteration is ITER < LAST).

  • ITER[inout] Loop index.

  • BODY[in] The loop body.