Talk:More C++ Idioms/Thin Template

"Good optimizing compilers only generate object code for functions for class templates that are used in the program." - I think that this applies to ANY standard-conforming compiler. I'm almost sure that standard requires it - consider the following example: This code compiles, but if you uncomment the commented out line, then it will fail complaining that A has no such a member. Here, the compiler not only doesn't have to, it just cannot produce object code for B::method2. So I'm removing the "Good optimizing" part to correct this. --Rad3k (talk) 00:30, 26 January 2010 (UTC)


 * Generally speaking without considering the example above, but in C++ general terms (those that the original text aimed to cover), optimizations aren't (can't be) defined on the standard. The standard sets rules and best practices that dictate inputs and output, we can even say that it also provides examples on how those can be accomplished (but most aren't included on the standard, but certainly on the proposal and demo implementations).
 * Even if you can find an example that "generates" a single way of doing one or a set of optimizations you can't generalize, this is made clear by the standard itself in the defining several things as implementation dependent. Furthermore the word optimization can have different meanings/goals and the programmer "in good optimizing compilers" can define his aspirations for the optimized outcome, how good the compiler is at optimizing depends on the level of satisfaction the programmer gets from the resulting compilation.
 * Another issue with the correction, is that reducing it to simply compiler will probably be incorrect since there isn't a perfect C++ compiler, one 100% standard compliant (I'm certain of some that aren't). Good in this case meant well behaviored compiler, one of the more standard complaints. --Panic (talk) 03:16, 26 January 2010 (UTC)