C++ – Metaprogramming and High-Performance Applications (CPP5)

Programming, C, C++

Since C++20, concepts simplify templates and type parameters. This enables replacing virtual methods and heavy OOP with designs focused on performance and predictable latency, important for embedded and real-time systems.

C++26 brings compile-time reflection to express metaprogramming more succinctly, while current standards already provide many library tools to adapt. The course covers C++20/23/26 with examples using constexpr and templates.

THIS TRAINING COURSE WILL HELP YOU:

  • Identify compile-time optimization opportunities in C++
  • Learn metaprogramming features in recent C++ standards
  • Practice working with templates in a variety of patterns
  • Understand how C++ code executes at compile time

WHO SHOULD ATTEND?

  • Experienced C++ developers who want to update their skills
  • C++ developers wanting to learn templates, concepts and constexpr
  • Practitioners interested in industrial languages and their limits

COURSE LOCATION AND AVAILABLE DATES



This course is not scheduled as a public course.
It is delivered exclusively as customised training. The content, duration, date, and delivery format are tailored to the customer's requirements and can also be provided in English.

Request customised training

Course content:

Hide details
  • Metaprogramming in C++20 and C++23
    1. Creating high-performance, generic code
    2. Enabling maximum compiler-driven optimization
    3. Clearer and more maintainable designs than before
  • Programming with templates
    1. Parametric data structures
    2. Generic algorithms and helper types
    3. Static type checking and safety
  • Template specialization
    1. Special handling for particular cases
    2. Specialization via tagging and policy classes
    3. Metafunctions and compile-time computations
  • Constraining type parameters
    1. Documenting requirements on types
    2. SFINAE and programming with type traits
    3. Explicit constraints using concepts
  • Easier work with templates
    1. Shorter function template syntaxes
    2. Deducing this and perfect forwarding
    3. CTAD and omitting explicit type parameters
  • Combining OOP and templates
    1. Using inheritance without virtual methods
    2. Augmenting functionality with CRTP
    3. Type erasure with templates and inheritance
  • Variadic templates
    1. Support for a variable number of parameters
    2. Expressions based on parameter packs
    3. Techniques using multiple inheritance patterns
  • Header-only libraries
    1. Modern role of the inline keyword
    2. ODR (one-definition rule) and how it behaves
    3. Interaction with templates and class code
  • Metaprogramming beyond templates
    1. Compile-time evaluation patterns
    2. Keywords constexpr and consteval
    3. if constexpr, if consteval and static_assert()
  • Combining constexpr and templates
    1. Type-based branching at compile time
    2. Simplifying certain template patterns
    3. Constexpr function and variable templates
  • Template library design
    1. Methods vs free (non-member) functions
    2. Argument-dependent lookup (ADL)
    3. Customization points for extensibility
  • Implementing generic templates
    1. Specialized smart pointer implementations
    2. Custom container types
    3. Data structures without dynamic allocation
  • Bonus: Reflection in C++26
    1. Type and variable introspection facilities
    2. Embedding metadata into code
    3. Practical applications of reflection
Prerequisites:
Good knowledge of programming in C++.
Recommended previous course:
C++ – Practical Programming for Advanced Developers (CPP2)
Recommended follow-up course:
C++ – Design Patterns and Idioms (CPP3)
Schedule:
3 days (9:00-17:00)

Training and learning environment