I’ve tried to dig into C++ template metaprogramming a number of times in the past. In general I’ve found that the techniques were clever but I haven’t found any places where I felt they’d be an improvement over the things I’m already doing.
Given there is quite a bit going on in this area and the standard library and boost both use metaprogramming techniques extensively, I’m diving in again. I’m back in the C++ world and working in a C++ 2011 compliant environment so I’m going to put a bit more energy into this dive and see if I can come away with useful techniques in addition to the curious but seemingly over-complex bits I’ve seen in the past.
I’m starting with my older and thinner book C++ Template Metaprogramming which seems to be a bit easier of a read.
I’ll likely then hop over to Advanced Metaprogramming in Classic C++ which looks more comprehensive (if perhaps a little dated) but is definitely harder to get started on.
I’ve ordered a few books that seem to also look interesting:
- Modern C++ Design: Generic Programming and Design Patterns Applied which is older but seems to get good reviews (and I got a used copy for cheap on Amazon).
- Discovering Modern C++ which looks newer and perhaps more of a gentle introduction.
- Metaprogramming in .NET because .NET is also an interesting environment and I’m curious whether it is as crippled as java generics. I suspect that it isn’t as Microsoft has been more willing to make forward looking changes to their VMs to support useful new functionality.