Skip to main content
  1. Tags/

Metaprogramming

2026


How to annotate in C++26 (1)

·1228 words·6 mins

This post shows how to use different kinds of annotations in C++. Starting with a simple [[=annotation]], it moves to a more powerful [[=derive(Annotation)]] syntax, and ends up discussing the merits of using stateful annotations, like [[=derive(Annotation(WithSomeValue))]].

More ...

Annotations in C++26 static reflection

·1322 words·7 mins

C++26 added static reflection to the already big bag of compile-time features. One of the most powerful tools that made it into the language, as part of the reflection package, is the ability to use custom annotations and to inspect them at compile time. Here, we will see how to define simple annotations, and how to use reflection to extract them at compile time to generate code.

More ...