Presentation: Tweet"Using typelists and template metaprogramming to generate code and avoid duplication"
In 2001 Andrei Alexandrescu’s “Modern C++ Design: Generic Programming and Design Patterns Applied” was published, introducing typelists as a way to express lists of types and manipulate those using templates. These techniques can and have been used in practice in places where similar code is duplicated for a set of types. Instead of defining a type and adding broiler template code, a typelist of the types is created at the place where they are defined. This typelist is then used together with template specialization to get the compiler to generate the type specific code. The result is a smaller code base with more functionality and little or no (source) code duplication, and less error prone code (same or no bugs for all types). The presentation covers advanced practical uses of the techniques outlined above that generate efficient type safe code and avoid duplication.
Download slides