Consider a function object F
taking a constexpr size_t
argument I
struct F
{
template
constex
This is not exactly an answer and my question still stands, yet I have found a workaround that gives an impressive boost in compilation. It is a minor tweak of the solution given in the question, where parameter R
is moved from operator()
outside to structure idx
, and the terminating condition now includes both R
and N
:
template <
typename F, size_t L,
size_t R = 1, size_t N = 0, bool = (R < 2 * L && N < L)
>
struct idx //...
The entire code is given in this new live example.
This approach apparently cuts down a huge number of unnecessary specialization combinations for R
. Compile times and executable sizes drop dramatically. For instance, I have been able to compile in 10.7/18.7 seconds with Clang/GCC for L = 1<<12
(4096), yielding an executable of 220/239 KB. In this case, nm -C
shows 546/250 versions of operator()
.