CppCon 2016 has ended
Monday, September 19 • 2:00pm - 3:00pm
Template Normal Programming (part 1 of 2)

Log in to save this to your schedule and see who's attending!

    What is "template normal programming"? It's template metaprogramming without so much of the "meta" part!  During this talk, I promise not to mention SFINAE, or recursion, or standard type traits. We'll focus on the common scenarios "I think this code could benefit from templates, but I don't understand how to organize it;" "I can't get anything to compile without errors;" and "My coworker wrote some template code and I don't understand any of it." 

    In Part I of the talk, we'll start with function templates and class templates, then explain variable templates (new in C++14) and template aliases (new in C++11). We'll do a deep dive into template type deduction; then talk about full and partial specialization; and finish up with an example that motivates the final feature of C++11 template syntax, explicit instantiation.

    In Part II of the talk, we'll begin by demystifying tag dispatch and traits classes; discuss situations in which you have to add disambiguating "template" or "typename" keywords (and why); and do a deep dive into the rules of what gets instantiated when and where. We'll revisit template type deduction just long enough to explain how it works for variadic templates; and explain two common template idioms — the Curiously Recurring Template Pattern and the Mixin Pattern.
    Time permitting, we'll finish by exploring the big new features of templates according to the C++17 Draft Standard:
    - template
    - type deduction for class template constructors
    - explicit deduction guides
Slides are here: Part 1, Part 2

avatar for Arthur O'Dwyer

Arthur O'Dwyer

Arthur O'Dwyer is the author of "Colossal Cave: The Board Game," "Mastering the C++17 STL" (the book), and "The STL From Scratch" (the training course). He runs professional C++ training courses, is occasionally active on the C++ Standards Committee, and has a blog mostly about C... Read More →

Monday September 19, 2016 2:00pm - 3:00pm
Vanity (Room 404) Meydenbauer Center