Loading…
CppCon 2016 has ended
Back To Schedule
Thursday, September 22 • 4:45pm - 5:45pm
Variadic expansion in examples

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Templates - and variadic templates - are an important aspect of writing a successful library in C++; libraries that can deal with custom types the user creates greatly eases their use. Variadic templates specifically are still a new, relatively unknown and at the same time quite a buggy (in the sense of bugs in their implementations) tool, but nevertheless, they offer much easier ways of creating truly generic types and functions.

This talk will focus slightly less on variadic templates in general; the common pitfalls will be discussed, but more attention will be given to the tool of parameter pack expansion and all the contexts where it can be used, especially as a code generation tool.

The talk will start mostly from scratch, assuming the audience's general knowledge about templates. It'll introduce the idea of variadic templates and general syntax and typical techniques for their use. Next, it will head into the (mostly) unknown and buggy lands of the interesting uses of variadic packs, like unpacking a tuple into a function call using `std::integer_sequence`, the use of empty packs for a slightly easier way to work with `enable_if`. The final examples will explain the way of invoking an expression per every argument in a pack, and dispatch to appropriate version of code for each of the argument types based on runtime values, which will be used to more easily create variant visitors.

Speakers
avatar for Michał Dominiak

Michał Dominiak

System Software Engineer, Nvidia


Thursday September 22, 2016 4:45pm - 5:45pm PDT
Bowie Hall (1st Floor Hall) Meydenbauer Center
  lecture