In case you missed it, from Nicolás Brailovsky's blog -- an interesting post after you get past a little ranting:
by Nicolás Brailovsky
From the article:
First, we need to start with a little clarification: using
template <class T>to parametrize a class, something like
std::vectordoes, is not template metaprogramming. That’s just a generic class (Java-pun intended). That is indeed a useful case for templates, but it has little fun in it.
Template metaprogramming is much more fun than mere generic classes...
A few notes:
- Even if template metaprogramming isn't something that every C++ developer will do on daily basis, it's worth being able to understand when you see it.
- For homework, try solving the Hanoi Tower problem by using template metaprogramming. [A sample for the 8-Queens problem is available here.]