A bird's-eye view of template C++

Slide header

Masterclass on templates and template metaprogramming in C++.

Abstract

C++ is a multi-paradigm programming language. This means it lends itself to solve a specific problem in various forms or styles. One of those forms or styles is object-oriented programming, with which C++ is often identified. Another strong suit of C++ is the support for generic programming and template metaprogramming. In this session we are going to look at modern-day C++ templates, and how we can use them effectively. Template programming sometimes has the reputation of being hard to understand and adopt, which surely may be the case for highly advanced usage. However, we will see that templates can be used for a myriad of purposes, which often have a low barrier to entry. Command of templates will greatly improve your efficiency and productivity as a C++ programmer. The topics we are going to cover include: generic programming, metaprogramming, type traits, static/compile-time polymorphism, variadic templates, and much more. Not only will we look at the state of templates in C++17, we will also address what C++20 and the future has to offer. Join me in this session exploring the wonderful and interesting world of C++ templates, and improve or refresh your knowledge.

Audience

This session is for professionals in software engineering, level novice to advanced, interested in C++. However, the underlying ideas of generic programming, metaprogramming and type traits do apply to many other languages. Are you a beginner or novice in C++? This session will introduce you to many topics related to template programming, as well as showing in-depth subtleties. The extensive list of resources accompanying the session will point you in the right direction to go about exploring yourself. Are you an advanced, experienced C++ engineer? Join me in this session to refresh your knowledge and perhaps discover new details or perspectives on the matter. There’s something here for everyone!

Topic listing

These are the main topics addressed in the talk:

  1. Introduction
  • The C++ ecosystem
  • History of C++ and templates
  • What are templates?
  • Compile-time programming
  • Generic programming
  • Class templates
  • Function templates
  • Variable templates
  • Alias templates
  • Concepts
  • Template parameters
  • Variadic templates
  1. Templates in practice
  • Type and function templates
  • Template specialization
  1. Taming templates
  • Polymorphism in C++
  • Compile-time polymorphism
  • Constraining templated entities
  • Static assertions
  • Type traits
  • C++20 Concepts
  1. Template metaprogramming
  • SFINAE

Conferences

A slimmed-down version of this session was presented at the C++ Italy Conference 2021, see here for the recording.

Adopting Rust means talking to Rust..but how?

Slide header

Practical strategies for integrating Rust into existing code bases using cross-language communication. This talk was presented at the Embedded Systems Engineering Kongress in Sindelfingen (DE) in 2025.

Abstract

Over the past decade, Rust has emerged as a powerful and versatile systems programming language for foundational and embedded software development, making it an attractive alternative or complementary tool for many software engineers and companies considering its adoption into existing codebases. However, adoption of a fundamental tool like a programming language comes with great challenges and considerations. An often-heard meme is the suggestion to “just rewrite it in Rust,” which, frankly, rarely makes sense for seriously substantial software projects. In reality, one of the main challenges for successful adoption is to strategically assimilate Rust into an existing code base or software ecosystem. Simply put, adopting Rust often means talking to it from other programming languages. But what are the possibilities here? What does this even look like? Does this mean all interfaces must be lowered to the C language level? Are there any tools to facilitate these interlanguage communication boundaries? And will language adoption always succeed? In this talk, I will answer these questions, and show that there are various ways to interact with Rust using the rich tooling ecosystem around foreign function interfaces (FFIs). We will look at low-level interfaces between languages, helper tools and systems, and work our way up to using WebAssembly to build interfaces between virtually every language and platform. I will show examples of FFI implementations between Rust and C, C++, Python and Kotlin, and the tools used to build these FFIs. Furthermore, we will take a look at build system considerations around including an FFI in your code base, and what some of the trade-offs are for language adoption. Even if adopting Rust specifically is not your goal, you will learn what dealing with language adoption and inter-programming language communication may look like in practice.

Audience

Professionals in software engineering, level novice to expert, interested in Rust, or foreign function interfaces (FFIs) between programming languages.

Talk layout

The talk is split up in the following parts:

  • Why talk to Rust?
  • Building bridges between languages,
  • The lingua franca of low-level FFIs: C,
  • Bridging larger spans: dynamic languages,
  • WebAssembly as the common tongue,
  • Conclusions + ending.

Goals

  • Show why Rust can be an interesting language for strategic adoption.
  • Show what a C-level inter-language FFI looks like and how it’s similar for all languages.
  • Show some of the tooling and libraries available to create FFIs at a higher level of abstraction.
  • Show what some of the pitfalls are of introducing an FFI, and how FFIs fail.
  • Show how creating an FFI is as much about build system orchestration as the FFI implementation itself.
  • Show how WASM/WASI can play a role in the future to facilitate a “uniform FFI” for all languages.
  • Show why careful design around ergonomics and behavior for a FFI are crucial for the success of it.
  • Provide the attendee with a “gut feeling” of the workings and considerations around FFIs to Rust.
  • Point the attendee to the Rust FFI examples code repository for reference.

C++ Fundamentals

Slide header

Training for beginners/intermediates on C++ to build a solid base of understanding.

Intro

The C++ fundamentals training aims to build a solid understanding of the C++ programming language, from basic to advanced engineering requirements. The knowledge is build from the ground up, covering fundamental techniques such as function and operator overloading up until more advanced topics such as template programming. Throughout the training we will maintain a focus on a safe, modern style of programming in C++, covering language features up to those part of C++20. Next to interactive lectures, large part of the training will be hands-on exercises to apply knowledge in practice.

Depending on the group skill level and preferences, the training can be adapted to emphasize specific subjects and exercises.

Objective

  • Build a solid understanding of modern C++,
  • Focus on a safe, modern style of programming,
  • Learn language features up to C++20,
  • Directly apply knowledge during hands-on exercises,
  • Learn about resources for further professional development.

Audience

Software engineers with basic programming experience (any language will do).

Program

This course is provided in two time two consecutive training days within two weeks (i.e. four days total).

Day 1

Introduction to C++, variables and initialization, control structures. At the end of the day, the attendees will able to explain what C++ is, how its compilation model works, and what it can be used for. They will also be able to read and write basic applications comprising of data structures and general control structures.

Day 2

Functions, classes and inheritance. At the end of the day, attendees will be able to read and write more advanced applications using data and control structures, and functions. They will be able to properly organize their code using functions and object-oriented data structures such as classes.

Day 3

Memory organization and management, error handling and exceptions, generic programming and templates. At the end of the day, attendees will understand the basic mechanics and important implications of memory management in C++. They will be able to employ exceptions as a means for structured error handling. Also, they will be able to use templates to create type-generic, compile-time instantiated code.

Day 4

The standard library, algorithms and iterators, operators and operator overloading. Optional topics (on request): constant expressions, the C++ tooling and information ecosystem. At the end of the day, attendees will have good sense of the C++ toolbox: the standard library. They will be able to employ algorithms and iterators, some of the most important parts of the standard library. Also, they will be able to use operator overloading to fully integrate their custom data structures into the language vocabulary. When leaving the course, they are left with handles to sources for further professional development in C++.

Large homework exercises

For those who are interested, there are a couple of larger homework exercises to choose from. Each of the exercises build up to a fully functional application in a number of smaller steps. These exercises are accompanied with explanation slides, solution code and extensive descriptions of the solution steps.

The large homework exercises are publicly available and can be found via this link.

High Tech Institute

This training is provided through High Tech Institute, more information here.

Exploring Rust

Slide header

Introduction course to the Rust programming language for experienced software engineers.

Intro

The Rust programming language offers guaranteed memory safety: a tremendous benefit in security-critical or concurrency-heavy software systems. Still, Rust is a compiled language without garbage collection, and it offers zero-overhead abstractions as well as top-tier performance optimization possibilities. And if that is not enough in and of itself, Rust features an expressive, modern syntax and an excellent tooling ecosystem.

Even though the Rust programming language is relatively young, it has been stirring up the software engineering community for some years now. But is Rust fit for production? Can it be applied in any software engineering field? Is Rust hard to learn? Can Rust interact with my existing code base or hardware? Despite its age, Rust is being widely adopted in production environments, in small and large tech companies alike. Rust is definitely fit for production, and can be applied in a plethora of use cases, from embedded environments, systems programming environments up to web applications. Furthermore, there are plenty of possibilities to have Rust interact with other programming languages or hardware devices. Even though there’s excellent documentation on Rust and many related topics, a good preparation is recommended, as the learning curve for Rust can be quite steep.

As a software engineering business, it may be challenging to adopt a new tool like Rust. Preparing for such a process is important, and will determine the success of the adoption as a whole. In this intense, two half-days introductory training course, experienced software engineers will learn about the benefits the Rust programming language can offer, and how to proceed for successful adoption of the language.

Objective

  • Showcase the strengths of the Rust programming language,
  • Build a basic understanding of the Rust programming language,
  • Build an understanding of the application domains for Rust,
  • Learn how Rust compares to some of the prevailing programming languages in systems programming,
  • Identify potential obstacles when adopting Rust, and how to overcome them,
  • Provide the necessary knowledge to build a strong value judgment of the Rust language for production.

Audience

Experienced software engineers (any language will do). The focus of the course is the field of systems programming, so experience in this field is highly beneficial.

Program

This course is provided in two afternoon sessions within two weeks (i.e. approximately 9 hours total).

Part 0

Course introduction: trainer and trainee introductions, learn about the layout and premise of the training.

Part 1

Introduction to Rust: in this part we will build an overview understanding of the Rust programming language; what are the main features and semantics, what are the application domains, and we introduce the tooling ecosystem around the language itself.

Part 2

Functional programming primer: as Rust firmly builds on concepts from function programming, it may sometimes alienate programmers that are unfamiliar with these concepts. In this (optional) part, we will make sure all trainees have a base understanding of the most common functional programming concepts.

Part 3

In-depth look at Rust: in this part we will dig deeper into the language. Using the overview understanding of the language acquired in the previous parts, we will be able to grasp the details of mechanisms like control flow structures, result and error handling, traits and generics, concurrency at large and unsafe Rust.

Part 4

The Rust tooling ecosystem: compared to other existing languages in systems programming, Rust has a very tightly integrated and rich tooling system to aid developers in their work. We will focus on the base tools, package ecosystem and standard library, as well as possibilities for augmenting the tool box with custom tools.

Part 5

Course recap and look forward: adopting Rust can be challenging, and is best approached strategically. In this part we will look at adoption strategies, potential hurdles and how to overcome them for successful adoption. Of course, we will also provide handles for further learning and development.

Large homework exercises

For those who are interested, there are a couple of larger homework exercises to choose from. Each of the exercises build up to a fully functional application in a number of smaller steps. These exercises are accompanied with explanation slides, solution code and extensive descriptions of the solution steps.

The large homework exercises are publicly available and can be found via this link.

High Tech Institute

This training is provided through High Tech Institute, more information here.

Functional-style C++

Slide header

Masterclass on functional-style C++.

Abstract

More often than not, C++ code is written in an imperative, object-oriented programming (OOP) style. In OOP, we encapsulate data state in abstractions, called objects, exposing an API to the outside world. The imperative style essentially means the code explicitly dictates the computer how a program must operate. However, frequently it makes sense to express what the program should accomplish, without specifying exactly how. This so-called declarative style generally results in code that is shorter, easier to reason about, and therefore less prone to bugs. Functional programming is a declarative programming style and has seen a strong increase in popularity over the last decades, even though it has been used in programming since the 1950s. C++ also caters for functional programming, especially so since the latest releases of the language. Join me in this journey of functional-style programming, and learn about higher-order functions, function purity, currying, algebraic data types, ranges and more. Being able to wield multiple programming paradigms effectively will definitely improve your productivity and the quality of your code.

Audience

This session is for professionals in software engineering, level novice to advanced, interested in C++. The focus of the content will be on the concepts in functional programming, applied to C++. Even if you can only read C++, there will be benefit from learning how the functional programming techniques are applied.

Topic listing

These are the main topics addressed in the talk:

  1. Introduction
  • Paradigms in the C++ ecosystem
  • Comparing OOP and FP
  • Imperative vs. declarative paradigms
  • Imperative vs. declarative C++
  • Main concepts in FP
  1. Higher-order functions and function objects
  • What is a higher-order function?
  • Function objects in C++
  • Implementing function objects
  • Passing functions as arguments
  • Partial function application
  • Currying
  1. Immutability and pure functions
  • Reasoning about code
  • Function purity
  • Pure functions and concurrency
  • Immutability in C++
  1. Lazy evaluation and ranges
  • Lazy evaluation
  • Ranges
  • Algorithms, views, actions
  1. Functional data structures and types
  • Functional data structures
  • Algebraic data types (ADTs)
  • Domain modeling with ADTs

Leading Edge C++

Slide header

Masterclass on Leading Edge C++, a roundup of C++20 and C++23.

Abstract

In C++ land, it’s Christmas every three years, when the committee comes up with a new version of the language. Each present contains a new language- or library-related feature, and the presents are plentiful. This all sounds quite merry and optimistic, but in reality, in the industry, we are often forced to stick with the presents of yesteryear. Hardware-related tool chains, standardization processes, or company policy dictate what we can or cannot use – often preventing us from using the very latest C++ version in production. However, that’s not to say we shouldn’t keep up-to-date! In fact, it can be hugely beneficial to be prepared for what’s coming in the next versions as it enhances our ability to plan ahead and adapt when the time comes to update. Join me in this session where we will look into the many great features C++20 offers, like concepts and the ranges library. With slightly less attention to detail, we will delve into C++23 which is soon to be finalized. So let’s be prepared and redefine what “modern C++” really is: an ever-evolving ecosystem of a great programming language.

Audience

Professionals in software engineering, level beginner to advanced, interested in learning about C++.

Topic listing

These are the main topics addressed in the talk:

  1. Leading Edge C++
  • How C++ is cooked up
  • C++20 – not just any update
  • Compiler support for C++20/23
  1. C++20: Modules
  • The problem modules solve
  • The simplest ever module
  1. C++20: Concurrency
  • The joining thread jthread
  • New synchronization primitives
  1. C++20: Compile-time validation with concepts
  • What concepts are about
  • Imposing type constraints
  • Constraining (member-)functions
  • Defining custom concepts
  • requires expressions
  1. C++20: Coroutines
  • What are coroutines?
  • Associated type promise_type
  1. C++20: Improving algorithms using ranges
  • Ranges
  • Range pipelines and views
  • Ranges, views and projections
  • The Range-v3 library
  1. C++20: More notable stuff
  • Array view type std::span
  • String formatter std::format
  • Default comparisons and operator<=>
  1. An outlook to C++23
  • C++23 in one slide
  • Multidimensional array view mdspan
  • Result type std::expected
  • Coroutine generator std::generator
  • Range extensions

Navigating the C++ standard library

Slide header

Masterclass on the C++ standard library.

Abstract

The standard library is the most valuable resource of building blocks for any C++ programmer. It’s an extensive toolbox packed with containers, algorithms and other utilities. Aside from the productivity gains from using the standard library, you will also build on the correctness of its implementation, which is often overseen. But exactly how well do you know your toolbox? Do you know the difference between std::accumulate and std::reduce? Can you distinguish between the algebraic data types std::variant and std::optional? Do you know there is such a thing as the erase-remove idiom? And why it is there? The standard library is such a vast collection of useful tools, a strategy for navigating and internalizing it is helpful. In this session, I will categorically handle the various sets of items in the standard library, such that we can build an overview understanding of it. With this knowledge, you will be able to effectively use it to choose the right tools for the job, and be a more productive C++ programmer.

Audience

This session is for professionals in software engineering, level novice to advanced, interested in C++.

Because the C++ standard library is part of the standard specification, each full implementation of the language will have one. Knowing what’s in the standard library and knowing how and where to find it is an essential skill for every C++ programmer.

Topic listing

These are the main topics addressed in the talk:

  1. Library overview
  • Library overview
  1. Iterators and containers
  • Iterators
  • Ranges
  • Operations on iterators
  • Containers
  • Types of containers
  • Choosing the right container
  • Sequence containers
  • Ordered associative containers
  • Unordered associative containers
  • Container adaptors
  • Allocators
  1. Algorithms
  • Algorithm categories
  • Non-modifying sequence operations
  • Modifying sequence operations
  • Partitioning operations
  • Sorting operations
  • Binary search operations (on sorted ranges)
  • Set operations (on sorted ranges)
  • Heap operations
  • Minimum/maximum operations
  • Comparison operations
  • Permutation operations
  • Operations on uninitialized memory
  • Numeric operations
  1. Miscellaneous examples
  • Various practical applications of standard library utilities

Rust for C++ developers

Slide header

Masterclass on Rust for C++ developers.

Abstract

Correct memory handling and avoiding undefined behavior is required for software to be reliable and secure. In C++, we deal with this by the compiler, experience, best practices, design rules, helper types, static analyzers, etc. However, memory errors are still one of the major sources of bugs in software. One of the main claims to fame for the programming language Rust is that it guarantees memory safety, even in concurrent contexts. This is a bold claim, which comes at the cost of restrictions enforced at compile-time. Still, Rust is very expressive, and in most ways it offers flexibility and performance similar to C++. Another attractive aspect of Rust is its ecosystem: the build system, standard library, tooling and package management. Rust is a relatively young language in the systems development realm, yet it sees a lot of adoption, even in production environments. As engineers, we must use the right tool for the job; perhaps for the next job this tool is Rust. In this presentation, I’m going to show what Rust is about, from the perspective of a C++ developer. Learning another programming language can be tough, but it will advance your programming, even in the languages you already know.

Audience

This session is for professionals in software engineering, level novice to advanced, interested in C++ and Rust.

We will look at Rust by looking through C++ glasses, so a prerequisite is that you know C++ at least at a basic level.

Topic listing

These are the main topics addressed in the talk:

  1. Introduction
  • Why learn Rust?
  • What are the benefits of learning another programming language?
  1. A Rust primer
  • The promises of Rust
  • What is undefined behavior?
  • How the promises are met (borrow checker, lifetime parameters, etc.)
  • Other language highlights
  • The Rust ecosystem (libraries and tooling)
  1. An in-depth look
  • Default language semantics (e.g. move, rebinding references and explicitness)
  • Expressions in Rust
  • Result types: (Option and Result)
  • Error handling
  • Traits
  • Generic programming
  • Concurrent programming
  • Asynchronous programming
  • Unsafe Rust
  1. Where to go from here?
  • Is Rust ready for production?
  • Hints to get started with Rust
  • Pointers to resources and websites

Rust Fundamentals

Slide header

Comprehensive training for intermediate/advanced engineers on the Rust programming language.

Intro

After reaching its landmark age of 10 years, the Rust programming language has shown its potential as a powerful programming language for many application domains. Initially mostly known for its hallmark feature of guaranteed memory-safety, the language expressiveness and tooling ecosystem for enhanced productivity deliver at least at much benefits. The unique approach to guaranteed memory-safety, polymorphism with traits and the use of various functional programming techniques in a language without memory garbage collection requires a diligent learning procedure. This course offers a comprehensive and systematic introduction to the Rust programming language, preparing the attendee for an effective and successful career using Rust.

Objective

  • Build a solid understanding of Rust
  • Focus on idiomatic programming practices
  • Learn language features up to the 2024 edition
  • Directly apply knowledge during hands-on exercises
  • Learn about resources for further professional development.

Audience

Software engineers of medium experience level (2+ years) with a decent base of general software engineering knowledge.

Program

This course is provided in two time two consecutive training days within two weeks (i.e. four days total).

Day 1

Introduction to Rust, ownership and borrowing, basic types and control structures. At the end of the day, the attendees will be able to explain what Rust is, how its compilation model works, and what it can be used for. They will also be able to read and write basic applications using custom data structures and control flow, while understanding Rust’s unique ownership system that guarantees memory safety.

Day 2

Pattern matching and error handling, collections and iterators, traits and generics. At the end of the day, attendees will be able to read and write more advanced applications using proper error handling with Option and Result types. They will be able to effectively use standard library collections and iterators, and apply the trait system to create reusable abstractions and share behavior among types.

Day 3

Advanced language features, concurrency and memory management, and functional programming. At the end of the day, attendees will understand advanced Rust concepts including closures, const generics, and dynamic polymorphism. They will be able to write concurrent programs using threads and basic asynchronous programming, and understand how unsafe code can be applied prudently for high-performance requirements.

Day 4

Project organization and tooling, macros and the ecosystem, application domains. Optional topics (on request): cross-compilation, foreign function interfaces, advanced async programming. At the end of the day, attendees will have a good sense of the Rust toolbox: project structure, essential tooling like Cargo and Clippy, and the crate ecosystem. They will understand the three forms of macros in Rust and be able to write basic declarative macros. When leaving the course, they are equipped with knowledge of how Rust applies to various domains and have handles to sources for further professional development in Rust.

Large homework exercises

For those who are interested, there are a couple of larger homework exercises to choose from. Each of the exercises build up to a fully functional application in a number of smaller steps. These exercises are accompanied with explanation slides, solution code and extensive descriptions of the solution steps.

The large homework exercises are publicly available and can be found via this link.

High Tech Institute

This training is provided through High Tech Institute, more information here.