Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Class Template Argument Deduction in C++17

ACCU Conference via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore Class Template Argument Deduction (CTAD) in C++17 through this comprehensive ACCU 2018 conference talk by Timur Doumler. Delve into the practical applications of CTAD and automatic deduction guides for writing cleaner, more concise code. Learn how to effectively use CTAD with the C++ standard library and when designing custom classes. Understand the language rules behind CTAD, including when and how to implement user-defined deduction guides. Discover potential pitfalls such as unexpected template argument deductions, constructor selection issues, and unsafe code scenarios, along with strategies to avoid them. Cover topics including template argument deduction in C++98, vector implementations, sequence containers, maps, locks, mutexes, smart pointers, type identity idioms, templated constructors, std::function, SFINAE, aggregates, and CTAD's interaction with nested types and smart pointer conversions.

Syllabus

Intro
template argument deduction in C++98
vector
pitfall!
magic!
trap #1: the order matters
trap #2: list-initialisation has priority
sequence containers
map
locks & mutexes
example with no arguments
other STL classes...
smart pointers
how to disable CTAD
type identity idiom
member typedef
templated ctor
std: function
deduction guides SFINAE
aggregates need explicit guides
CTAD uses the primary template
CTAD not just in declarations!
no CTAD in nested types
CTAD + smart pointer conversions

Taught by

ACCU Conference

Reviews

Start your review of Class Template Argument Deduction in C++17

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.