The first timei’ve read about template metaprogramming was thanks to Andrei Alexandrescu (http://erdani.org/). I was just starting to actively use C++ at my job, so i wanted to know everything there is to know about it. I had read several books on C++, from entry level books which initiate you in its most basic syntax to ones that introduce you to higher concepts like the STL.
But know i felt ready to enter the next level: actively using template programming. I read two books: first ” C++ Templates: The Complete Guide ” by David Vandevoorde and Nicolai M. Josuttis and then ” Modern C++ Design: Generic Programming and Design Patterns Applied ” by the above-mentioned Andrei Alexandrescu. I think it’s fair to say that to most people reading this last book, it opens a complete new view at programming with C++. But i also think that most people think of it as being hard.
So i started asking myself:
Who is using template metaprogramming in his day to day programming?
And by “using” i mean:
– using the existing libraries (Loki library, Boost MPL, other)
– making use of template metaprogramming techniques in their own code.
What are you using template metaprogramming for?
Is the company you work for into constructing C++ libraries , or are you using it inside your company’s product?
Looking back at your usage scenario, do you think it’s worth it?
Template Metaprogramming being hard, i often wonder if it’s worth the trouble? I mean: what is i constructed some nifty use of the technique but most programmers don’t really understand what’s going on, did i not create a maintenance nightmare instead of solve one? So if you used it, would you use it again? If you used it, did you factor it out after having being sick of explaining 1000 times your code.
In short: what is your opinion on Template-Metaprogramming? Is it realy usefull or is it “C++ macho-ïsm” (Look what i can do with C++!!!).