#pragma GCC unroll with compile-time argument

129 Views Asked by At

Is there a way to unroll a loop in GCC based on compile-time (e.g., template) parameter?

The following does not compile, unless I replace unroll(N) with a concrete integer like unroll(8)

template<int N>
void fun ()
{
    #pragma GCC unroll(N)
    for (...)
         // body
}
0

There are 0 best solutions below