
On 02 Sep 2014, at 24:06, Robert Ramey
FWIW - I'm extremely skeptical of performance claims based on speculation. It wouldn't surprise me of compilers are already skipping compilation of dead branches for which it can be easily determined that there are no compile-time side-effects. In fact since I generally have very little problem with compile times these days - in spite of writing a lot of template code - I'll bet that compiler writers already do this. Not that it matters because it's just not a problem except in contrived pathological cases.
I know for a fact that Clang doesn’t (it doesn’t even have a notion of dead branches until long after all template instantiation is done), and I would be very surprised if any other compiler does - after all, that would be non-conformant, as it would allow erroneous programs to compile. Either way, my need for static if is to conditionally have specific declarations in a class template or not, so unless the library can do this (the suggested usage won’t work in a pure declaration context), it’s no use to me. Sebastian