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.

Location, current course term

Contact us

Custom Customized Training (date, location, content, duration)

The course:

Hide detail
  • 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
Assumed knowledge:
Good knowledge of programming in C++.
Recommended previous course:
C++ – Practical Programming for Advanced Developers (CPP2)
Recommended subsequent course:
C++ – Design Patterns and Idioms (CPP3)
Schedule:
3 days (9:00 AM - 5:00 PM )
Language: