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

Limited-Time Offer: Up to 75% Off Coursera Plus!
7000+ certificate courses from Google, Microsoft, IBM, and many more.
This course on Introduction to C++ Template Metaprogramming aims to teach learners the technique in modern C++. The learning outcomes include understanding how TMP can be used for checking constraints, selecting algorithms based on template types, and generating compile-time constructs. The course covers topics such as template syntax, template specialization, type traits, static assert, member detection, recursive templates, and compile-time safe printf. The teaching method involves reviewing techniques and examples for using TMP in libraries and application code. The intended audience for this course is individuals with a basic understanding of template syntax and template specialization who want to enhance their skills in C++ template metaprogramming.

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.