Archive

Posts Tagged ‘Template metaprogramming’

whatIsThisFor

November 23, 2010 4 comments

Check out this C++ code fragment at the beginning of  the MessageBase class template definition:

After staring at it for a few minutes, I was able to distill the essence of the idiom(???) used in the code as:

I can’t figure out why B was designed as a class template and not just a plain ole’ class that simply inherits from A (see below). It reminds me a little of the CRTP idiom but it’s not the same. Would you happen to know what problems it is intended to solve? Is it some template meta-programming technique?