
On 02/09/2014 00:06, Robert Ramey wrote:
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.
When you instantiate a template, it gets instantiated. It takes time. It takes place in RAM that is never freed until the end of processing the TU. There are costs associated to it. I don't see why there is any need to be skeptical about the workings of template mechanisms in C++ as implemented.