Splice & Dice
A Field Guide to C++26 Static Reflection
£172.50/$230/€200 (£45/$60/€55 for students)Available to book as a half day online workshop on the following dates
Watch The Workshop Preview
C++26 static reflection lets you inspect types, members, and annotations at compile time, and generate code from that information with zero runtime cost. If you've been solving these problems with macros or heavy template machinery, this is worth your attention.
Join Koen Samyn for a hands-on workshop that takes you from the basics of the reflection operators to building real applications with them. The workshop uses the experimental Clang branch on Godbolt, so you can follow along and experiment directly.
Building the Foundation
Before we get to reflection itself, we make sure the underlying mechanics are solid. We'll work through:
- constexpr vs. consteval: when to request compile-time evaluation versus when to require it.
- template for: iterating over members at compile time with guaranteed unrolling, where the type can change on each iteration.
if constexpr: branching at compile time to create type-dependent code paths.
What You Will Build
The workshop is structured around progressively more complex exercises:
- The reflection operators: Extract metadata with the
^^operator and splice it back into source code with[: ... :]. - Automatic JSON serialization: Build a recursive serializer that inspects any struct and generates its JSON representation — no per-type boilerplate needed.
- The visitor pattern: Apply a recursive reflection framework to visit struct members without adding virtual methods or accept functions to your domain types.
- Custom annotations: Use
[[=imgui::FloatSlider{...}]]-style annotations to drive automatic UI generation or shader bindings. - std::meta::substitute:
Instantiate reflected templates with compile-time values to build inlinable function tables — demonstrated through a small stack-based VM that compiles down to a single movinstruction.
What Makes This Different from Runtime Reflection?
If you've used reflection in Java or C#, the key difference is that C++26 reflection happens entirely at compile time. The compiler uses the metadata to generate code, then discards it. There is no runtime cost and no runtime type information beyond what you'd have without reflection.
Who Is This For?
C++ programmers who are comfortable with template basics and want to see what static reflection can do in practice. The feature is still experimental (P2996), but the tooling is available today on Godbolt, and the workshop gives you concrete patterns you can start applying as compiler support matures.
Outline
[15 min] Problem statement: an example of a compute shader project (game of life) with configurable parameters (uniforms) in ImGui that does not use reflection. Highlighting some of the problems when adding features to this project.
[20 min] Installation of Clang-P2996 - experimental branch of clang which enables the use of reflection.
[20 min] A simple concept - refresher on concepts and concept syntax: Bindable concept that defines the interface that bindable objects should have + explanation on how to check if a class conforms to the concept.
[10 min] Two implementations of this Bindable concept : BufferResource<Type,Set,Binding> and Uniform<Type,Location>.
[40 min] Main feature: implementing a free function that uses reflections and calls (for example) the bind() method on every nonstatic data member that conforms to the Bindable concept. Difference between splicing and member "extraction": A. Splicing: self.[:m:].bind() in an expansion statement. B. Extraction: extract<MemberT K::*>(m); (self.*pm).bind(); (rock-solid across forks). Compare assembly (manual vs reflective) at -O1 to show zero overhead.
[30 min] Interlude : Demonstrate generating an ImGui interface with reflection --> it is finally possible to create tech demo user interfaces without writing boilerplate code for each editable "component". How to set min/max for slider type variables.
[30 min] Taking it further: compile time checks --> {Set,Binding} unique ? {Location} unique? Does the Type have an exact representation on the gpu side ?
[20 min] Taking it even further: reflect on the shaders with spirv-reflect and generate constexpr values that rapport the various buffers and uniforms in the compute (or other) shader. Check if every buffer or uniform is represented on the CPU side.
[10] Conclusions and practical reflection guidelines + Q&A<

Koen Samyn
Koen is a senior software engineer and lecturer at digital art and entertainment whose primary focus is bringing modern C++ to GPU-driven game technology. Over the past decade he has built and optimized compute-shader pipelines for lighting, physics, and inverse kinematics. In the classroom Koen mentors future developers on topics such as C++20/23 concurrency, data-oriented design, and the nuances of dispatching workloads across CPU and GPU.
Register A Ticket!
Privacy Notice
Please note that the email address that you use for registration will be shared with the instructor so that if needed they can contact you on matters relating to the workshop before, during or after it takes place.
Cancellation Policy
Purchased tickets may be cancelled for a full refund, less a 5% processing fee, up to four weeks before the event.
From four weeks to five days before the event the cancellation fee is 40%.
During the last five days before the event the cancellation fee is 80%.
If you have any questions or need more information regarding anything relating to ticketing, please contact info@cpponline.uk
Payment methods
Ticketing is provided by Tito and credit card processing by Stripe. For alternate payment methods, or invoices, please contact us.
If you are paying on behalf of an EU or EC company with a reverse charge VAT arrangement with the UK then it is especially important to contact us first.
Other Available C++Online Workshops
No related workshops found.
