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

YouTube

Introduction to C++ Template Metaprogramming

NDC Conferences via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore C++ Template Metaprogramming techniques in this comprehensive conference talk. Learn how to use TMP as a precursor to C++17 Concepts for checking constraints and producing clear error messages. Discover how to optimize algorithm implementations based on specific template types. Delve into introspecting C++ types at compile-time and generating compile-time constructs for time-saving and fully-compile-time computation. Cover topics including type constraints, algorithm selection, compile-time computation, class template specialization, type traits, static assert, member detection with void_t, expression SFINAE, template specialization based on traits, tag dispatch, std::enable_if, recursive templates, constexpr over types, and compile-time safe printf. Gain practical knowledge to apply TMP techniques in libraries and application code, building upon basic template syntax and specialization understanding.

Syllabus

Intro
Motivation: Checking Type Constraints
Motivation: Algorithm Selection
Motivation: Compile-Time Computation Some fairly complex computations can be performed ahead-of-time
Reminder: Class Template Specialization
A large collection of metafunctions that check properties of types
Type Traits and static assert
Non-Constraining Use of Traits
Member Detection with void_t
Generalized Version (Expression SFINAE)
Specializing a Template Based on Traits - There are multiple approaches, each with its merits Hand-written template specialisation
Hand-Written Template Specialization
Tag Dispatch Overload functions on a type that depends on a type tra les
distance_helper
std::enable_if
Recursive Templates
Some Simple Uses
constexpr Over Types
Compile-Time Safe printf

Taught by

NDC Conferences

Reviews

Start your review of Introduction to C++ Template Metaprogramming

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.