CppCon 2015 Variadic Templates in C++11 / C++14 - An Introduction--Peter Sommerlad

Have you registered for CppCon 2016 in September? Don’t delay – Early Bird registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2015 for you to enjoy. Here is today’s feature:

Variadic Templates in C++11 / C++14 - An Introduction

by Peter Sommerlad

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Writing class templates and functions accepting a variable number of arguments has been a burden before C++11. With variadic templates, both class templates with a variable number of arguments as well as functions can be formulated much easier and more type safe way.

Nevertheless, the authoring of variadic templates can be challenging for the uninitiated. Even the interpretation of variadic template code can be a problem, as Olve Maudal's famous pub quiz shows.

This session will build up understanding and the ability to use and author variadic template functions and variadic template classes from easy examples up to more complicated applications such as employing std::forward correctly, std::integer_sequence and other upcoming language features such as a template UDL operator that bridges the gap between string literals and std::integer_sequence.

Understanding pack expansion, sizeof... and other hard to get on first sight issues are my goal. In the end you should have seen guidelines that help you avoid the template instantiation trap from the pub quiz and correct usage of std::forward in your variadic templates.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.