In case you missed it, from Nicolás Brailovsky's blog -- an interesting post after you get past a little ranting:
C++ Template Metaprogramming Introduction
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 likestd::vector
does, 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.]
Add a Comment
Comments are closed.