Photo of Nicolai Josuttis

Nicolai Josuttis

Nicolai is an independent systems architect, technical manager, author, and consultant. He designs mid-sized and large software systems for the telecommunication, traffic, finance, and manufacturing industries. He is well known in the C++ Community for speaking and writing with authority about C++ (being the author of 'The C++ Standard Library', 'C++ Templates', and 'C++17 - The Complete Guide') but is also an innovative presenter. He is an active member of C++ standardization committee for more than 20 years now.

Modern C++ Template Programming

full day workshop

Each and every C++ programmer uses templates. Containers such as vector<> or array<>, strings, algorithms such as sort(), iterators, and I/O streams are all implemented as generic code. Modern C++ adds type-traits, smart pointers, template member functions such as emplace(), and generic lambdas as a tricky form of generic code.

Nevertheless the knowledge and understanding of how to implement and use templates is very limited and each and every programmer is sooner or later getting lost. This workshop therefore discusses templates for a whole day to make clear what it means to use templates and how to use them in practice. The focus is on Modern C++ demonstrating the benefit of using the language features of C++11, C++14, and even C++17. As a result the general understanding of templates will be improved and generic code might become more helpful and less surprising.

We go through the standard template topics: function templates, class templates, non-type templates, specialization a on other tricky basics and spice them with the modern language feature to do up-to-date template programming. Then special modern features come into play: move semantics, variadic tempates, fold expressions (C++17), class template argument deduction (C++17). Finally some special consequences: polymorphism with templates (including using std:variant<>), type utilities, SFINAE, and more on metaprogramming.