Talk:C++ Programming/Templates/Template Meta-Programming

Comments on Section 'History of TMP' Previously in Discussion Header
The example given (for prime numbers) doesn't print its results in an error message; it actually compiles once you add the missing
 * 1) include

Without it, it fails without printing out primes.


 * I've added the include. --Panic (talk) 16:35, 15 October 2010 (UTC)

131.246.191.181 (talk) 09:45, 29 October 2010 (UTC)
 * I looked up the original example of the prime numbers by Erwin Unruh. It can be found here: http://www.erwin-unruh.de/primorig.html . The thing is, that it is not valid C++ anymore. That's why he provides a new version that works as expected: http://www.erwin-unruh.de/Prim.html . IMO it should be either stated that the source code shown on the page is not the original source code as it prints the numbers at compile time, or perhaps the working example of Erwin Unruh can be added.
 * Nevertheless, the existing source code is a good example how TMP is used today because people want to compile their programs and output results at runtime.

--Simon 131.246.191.181 (talk) 09:45, 29 October 2010 (UTC)

Actually, I've found out that the code that is supplied here actually compiles in Xcode 5.1.1 (build 5B1008) when it uses version 855 of cctools, version 236.4 of ld64, and version 5.1 (build 'clang-503.0.40,' based on LLVM 3.4svn) in its toolchain!

History of TMP: "not generally appropriate for [...] systems programming contexts"
I do not understand what's the rationale behind this claim. The (subjective) complexity of the source code does not induce that TMP does not fit the context of systems programming. IMO, the generic nature plus excellent compile-time optimization properties render it a suitable solution for a wide range of problems in systems.77.189.159.119 (discuss) 21:31, 19 March 2011 (UTC)


 * I have not re-read the text, just answering of the top of my head in defense of that argument (of course there are situations for every type of decision). I think the "not generally appropriate" wording is ok but could probably be extended (and probably is backed up by some text before of after it appears), TMP has the problem of consuming resources (especially space) over compatible alternative solutions, the "not generally appropriate" does not exclude it's possible use just points out that it is often not seen as the best approach (there is ample documentation backing up this argumentation). --Panic (discuss • contribs) 21:53, 19 March 2011 (UTC)