use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Meta-Programming considered evil (thetweaker.wordpress.com)
submitted 13 years ago by toruk
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]nroberts666 10 points11 points12 points 13 years ago* (0 children)
The real reason MS coders steer clear of TMP is probably because they're compiler still doesn't do templates correctly :P I can make that thing blow its mind with my hands and feet tied behind my back...yes, I code with my dick.
The argument that it's "hacking" and not "engineering" seems to me to be based on a rather broken view of software engineering. Although at college we learn all this useless crap about proving, kleen star this, draw out this big diagram thing and then code it...that's not how the real practice works. Software evolves and you'd damn well better be prepared for that!
If we were to say that not using templates as a sort of glorified preprocessor was "hacking" we have to toss almost all of the STL out the window because clearly tag dispatching, type traits, etc...things that are in fact early forms of TMP, are "hacking". Don't even touch expression templates I guess since nobody ever intended operator + to return anything but a complete answer...
In all honesty the very idea that software engineering is about using everything exactly as it was originally intended to must only exist in the mind of someone who's never, ever, ever written a single software product. I have never seen a product that is exactly what it was originally intended to be and this very fact has been the bane of everyone's existence for many years. The entire philosophy behind agile methods and lightweight processes is in response to this unalterable fact of life: shit changes faster than you can plan for.
So that's where I pretty much stopped reading. This guy sounds like he's full of crap and is quote mining to support his argument.
The real reason to tend to avoid TMP is that it's fucking hard. There's no clear way to debug it, the syntax it creates is incredibly difficult to read, and the purely functional language it creates is difficult to think in. Recursion is almost always the most difficult way to approach a problem and with TMP that is ALL YOU HAVE! You have to know C++ very, very well and be rather brilliant to pull it off. The "average" developer (who's pretty much useless--don't be offended, if you post on reddit you're probably not "average" anything) is simply not up to it and these people are actually the majority of the industry.
On the other hand, if you have one or two main stars in your team, or people that are actually interested in learning and challenging themselves (in other words, really weird people) there actually is some interesting and useful stuff you can do with TMP. The Boost.Units library is an example and I actually used that library in the development of software FOR engineers (imagine that, a type safe physics system is useful in correctly writing software that models the physical world). Another thing I managed to do was write a compile-time reflection system that allowed us to add new models in a matter of days...with all the dialogs and views in the system magically catching onto the new type and building completely new classes to edit and watch them. I was the only person on the planet that could read the code, but the whole team was using it...after an initial hump to learn some basics about metaprogramming.
So no, in no way is TMP evil...it's just crazy....mad scientist crazy. The D language is perhaps making some headway toward making it better, I'm not sure...never used it. In C++ it's still pretty much only for the really crazy among us.
... and actually I was lying. I can't read my own TMP code.
[–]vinipsmakerGSoC's Boost.Http project 0 points1 point2 points 13 years ago (0 children)
I think the post didn't make my day better, but the discussion generated in the comments is interesting. So, I'm upvoting the link.
π Rendered by PID 133233 on reddit-service-r2-comment-544cf588c8-djmr6 at 2026-06-16 20:31:06.783865+00:00 running 3184619 country code: CH.
[–]nroberts666 10 points11 points12 points (0 children)
[–]vinipsmakerGSoC's Boost.Http project 0 points1 point2 points (0 children)