Skip to content
A basic C++ Template Meta Programming
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Factorial Began adding code files Feb 13, 2017
Inheritance Typos Sep 20, 2018
Matrix Typos Sep 20, 2018
PowerSet Added .editorconfig Feb 14, 2017
StaticAssert Inheritance added Feb 16, 2017
TypeList Improved example Jun 29, 2017
TypeSelection Finished SA Feb 14, 2017
.editorconfig Added .editorconfig Feb 14, 2017
.gitignore Initial commit Feb 12, 2017
LICENSE Initial commit Feb 12, 2017
Presentation.pdf Typo Oct 31, 2018 README updated Dec 2, 2017
index.html Hosted on website Dec 8, 2017

C++ Template Meta Tutorial

This repository contains a presentation that is an introduction to C++ Template Meta Programming. All of the code in the presentation is in this repository. Much of what is shown in this presentation is no longer required to know with the increased support for template meta programming in C++11, C++14, and C++17. So why learn it? This presentation includes derivations of each of the techniques which will help get you into the mindset of template meta programming. Furthermore, while the actual code may be legacy, all of these techniques are still fundamentals and frequently used for template meta programming.


A copy of the presentation is hosted here. The code repository is located on github here.


C++ Template Meta is a huge and very diverse topic. It would be naive to say that this tutorial encompasses even a small portion of this topic. It is just a small introduction to some of techniques used in TMP. Furthermore, this presentation was designed to be given by someone who knows TMP. As such, while the presentation contains all necessary information, explanations may be in bullet points as it was written so that the instructor could explain each point.


This presentation heavily utilizes the following text: Modern C++ Design by Andrei Alexandrescu. If you are interested in TMP, I highly recommend this book.


The code in this repository is compiled with clang++ version 7.0.2, and gcc 4.9.2. C++99 is required for most of the code, however some of the files require C++14. The reason different compilers and versions of C++ are used is to demonstrate examples where clarity of error messages is helpful and to demonstrate how C++ TMP has evolved from the primitive form you will learn to a more advanced and useful form which includes variadic templates among other amazing features.

You can’t perform that action at this time.