This year marks the tenth anniversary of “Modern C++ Design” and its promotion of policy-based design - simple, modular, white-box designs obtained by mixing and matching small behavioral components.
The technique has gone through the expected cycle - incredulous reception, hype, backlash - to become just another tool in the shed with its own well-understood advantages and disadvantages. Template templates are complicated, except when they bring enough leverage to pull their weight; freedom in design is good, except when there’s too much of it; and so on.
One thing is for sure—policy-based designs in C++ exploit some of its most advanced features and naturally could use a few more.
This talk does two things. First, it looks back at the evolution of policies up until now. Second, it explores what a “postmodern” C++ world looks like with C++2011 features in tow. Policy-based design is greatly helped by language features such as variadic templates, template aliases, and lambdas, but also by library artifacts such as function objects and smart pointers. Each of these features reduces the efforts of implementing some of today’s policy-based designs and, most importantly, open the door to even more powerful ones.