Develop an understanding of managing types at compile-time in this lesson.

A typelist (also called type list) is a compile-time construct that enables us to manage a sequence of types. A typelist is somehow similar to a tuple but doesn’t store any data. A typelist only carries type information and is used exclusively at compile-time for implementing different metaprogramming algorithms, type switches, or design patterns such as Abstract Factory or Visitor.

Note: Although both the “type list” and “typelist” spellings are in use, most of the time we will find the term “typelist” in C++ books and articles. Therefore, this will be the form we’ll use in this course.

Typelists were popularized by Andrei Alexandrescu in his book, Modern C++ Design, published a decade before the release of C++11 (and variadic templates). Alexandrescu defined a typelist as follows:

Get hands-on with 1200+ tech skills courses.