{ protected: std::string Message() const { return "Hallo Welt!"; } }; int main() { // Example 1 using HelloWorldEnglish = HelloWorld<OutputPolicyWriteToCout, LanguagePolicyEnglish>; HelloWorldEnglish hello_world; hello_world.Run(); // Prints "Hello, World!". // Example 2 // Does the same, but uses another language policy. using HelloWorldGerman = HelloWorld<OutputPolicyWriteToCout, LanguagePolicyGerman>; HelloWorldGerman hello_world2; hello_world2.Run(); // Prints "Hallo Welt!". } Designers can easily write more OutputPolicys by adding new classes with the member function Print and take those as new OutputPolicys. Loki library Loki is the name of a C++ software library written by Andrei Alexandrescu as part of his book Modern C++ Design. The library makes extensive use of C++ template metaprogramming and implements several commonly used tools: typelist, functor, singleton, smart pointer, object factory, visitor and multimethods. Originally the library was only compatible with two of the most standard conforming C++ compilers (CodeWarrior and Comeau C/C++): later efforts have made it usable with a wide array of compilers (including older Visual C++ 6.0, Borland C++ Builder 6.0, Clang and GCC). Compiler vendors used Loki as a compatibility benchmark, further increasing the number of compliant compilers. Maintenance and further development of Loki has been continued through an open-source community led by Peter Kümmel and Richard Sposato as a SourceForge project. Ongoing contributions by many people have improved the overall robustness and functionality of the library. Loki is not tied to the book anymore as it already has a lot of new components (e.g. StrongPtr, Printf, and Scopeguard). Loki inspired similar tools and functionality now also present in the Boost library collection. See also Boost (C++ libraries) Mixin References External links Alexandrescu's website (with book errata ) Smart Pointers (sample chapter from the book) Original source code from the book publisher 2001 non-fiction books Books about C++