#cpp26
94 posts tagged #cpp26.
Reflection can flag a dangling signature that GCC 16.2 does not warn about
A reflection lint of under 60 lines flags 3 of 5 declarations in a namespace on GCC 16.2: two return a view of a by-value owner, one returns a reference that can bind a temporary. For the view case GCC 16.2 gives no warning with -Wall -Wextra, a plain run prints garbage, and AddressSanitizer reports a heap use after free.
Constexpr constructors with virtual bases work in GCC 16 and Clang trunk
P3533R2 lifts the rule that a constexpr constructor cannot belong to a class with a virtual base. GCC 16.1 accepts it with -std=c++26 and Clang trunk accepts it, while GCC 15.3 and Clang 23.1 reject it. One case still differs: GCC 16 refuses a virtual call through a reference to the virtual base in a constant expression, and Clang trunk accepts it.
Replacing moc with reflection: 35 of 48 matrix rows match, and a class needs no macro
I listed 48 things moc processes or generates and gave each a verdict that a test must back. 35 rows are the same: 30 against a real moc's output, 5 by behaviour that moc cannot give. 7 differ in a stated way and 4 are not supported yet. A Qt class and a gadget now need no macro, because the base class finds the class through a default template argument.
Closing the known limits of the Qt observable models
The first post listed ten limits of the observable container and its Qt models. Three tests found real defects while closing them, a hash slowdown turned out to be code placement, and a row index made a change 42 to 125 times cheaper at large sizes.
The C++26 DIS ballot was reported as disapproved: the numbers, the sources and the next steps
The 12-week ISO ballot on C++26 ended on 22 October. Two named people report it was disapproved: 12 of 20 P-members in favour, where two thirds are needed, and 9 of 22 votes negative, where a quarter is allowed. No WG21 or ISO document states the tally yet. This post separates what the papers prove from what is reported, and lists the four routes the rules allow.
What a C++ contract would have to be to prove something
A reader asked for contracts that prove things instead of glorified assertions. On GCC 16.2 a postcondition does not reach the caller, a body-less predicate links only when ignored, and a bad constant port is already a compile error. The chain they want comes today from a type and a visible predicate.
Two problems confirmed by the spec's author, fixed in both bindings
The author of the container spec wrote that section 8.3 is a mistake, not a trade-off, and that the lazy row map is in the real code. Both generated bindings now announce a batch removal while the entries still exist and find a row by binary search: a hash drain at 10,000 entries went from 193 microseconds per removal to 320 nanoseconds.
Deriving equality, hashing, and ordering from structure
C++20 gave us `= default` for operator== and <=>. Reflection lets us do the same for hashing, plus go beyond default: include/exclude fields, custom combinators, and floating-point tolerances. All declarative.
What C++23 and C++26 promise about a moved-from function wrapper
None of the standard function wrappers promises an empty source after a move: std::function, move_only_function and copyable_function all leave it valid but unspecified. libstdc++ 16.1 empties all three, libc++ trunk keeps a copy in std::function and does not ship the other two. A small wrapper that states its own move works on both.
Portable SIMD is in C++26, and you can try it now
C++26 adds <simd>, a portable vector type that compiles to SSE, AVX, or NEON without a single intrinsic. GCC 16.1 does not ship the standard header yet, but the experimental version it grew from works today, and the programming model is the same: declare a vector, use the arithmetic operators, let the library pick the width.
Naming a constant makes GCC stop believing it is one
A C++26 expansion statement over a compile-time range works on GCC 16.1 when the range is written inline and fails when the identical expression is given a name. The error says the constexpr variable is not a constant. Clang accepts both, and the workaround is to delete the name.
228 Qt model edge cases, and the ones my models failed
I wrote down 228 edge cases for the observable Qt models and tested each one. 170 work, 22 are refused on purpose, 27 were defects that are now fixed, and 9 are still pinned. The defects included an editor that writes an empty value back, and a model that survives its container with stale rows.
Regenerating a Qt container library from a spec, with and without moc
A reader wrote their observable Qt containers down as a spec an AI agent can regenerate from. Two fresh agents built it, one with classic moc and one with typed signals through reflect-moc. Both pass all 17 acceptance entries, the moc version builds with MSVC, and the spec itself has a row lookup that costs 193 microseconds per removal at 10,000 entries.
One Qt class template can declare typed signals without moc
A Qt engineer named reflect-moc's last open limit as exactly his case: one observable container for many types, which moc cannot give signals. The cause was one line. Now one container template declares typed signals, one generic model serves seven Qt containers, and a random test with six wrong adapters and 31 mutants checks that ghost rows and ghost selections cannot come from it.
Replaying Qt Bridges' meta-object calls in C++ and diffing them against moc
Qt Bridges' Rust layer builds each class's meta-object at run time with Qt's private QMetaObjectBuilder. I replayed its builder calls on one class in C++ and compared the result with what moc generates, on Qt 6.10.3, 6.11.3 and 6.12.0. The registration API has no way to say that a property is read-only, to name a signal's parameters or to add an enum, and in the C++ analogue emitting a signal by name costs about 22 to 46 ns more than emitting it by index. Source commits, line numbers, measurements and what was not run are listed.
C++26 reflection runs on a compiler you already have
The received wisdom is that trying P2996 means the Bloomberg clang fork. It does not. GCC 16.1 has shipped reflection since April behind -freflection, using the standard <meta> header, and it runs the same code. The two implementations do disagree about what display_string_of prints.
Four official Qt examples build and run without moc
Four examples from Qt 6.10.3 (a QThread renderer, a QML tutorial, a widgets example and a queued custom type) were rewritten by a migration tool and built with AUTOMOC off. Each prints the same harness output as the moc build, with 0 warnings, and a build in which moc is replaced by a failing trap passes. The diffs are 14 to 111 changed lines, the tool left nothing for manual work, and the limits and the timing noise are listed.
C++26 tightened unevaluated strings, and GCC did half of it
P2361R6 makes encoding prefixes and numeric escapes ill-formed in the strings that only exist at compile time. GCC 16.1 rejects the prefixes and accepts the escapes; Clang 22.1 rejects both. The same source compiles on one and fails on the other, which is worth knowing before you rely on either.
simdjson 5.0 reads a struct from JSON keys in any order
simdjson 5.0.0 (28 Sep 2026) lists static reflection as an officially supported feature. A struct with a string, an int, a bool, a nested struct and a vector read from JSON with shuffled keys on GCC 16.2 and simdjson 5.0.2, and an integer of exactly 2^64 is now a big integer. The 1.8x speedup in the release notes covers parsing escaped Unicode.
Parsing your config file before the program exists
#embed puts a file into the translation unit and reflection enumerates a struct's fields. Together they turn a configuration file into a compile-time constant, with the keys derived from the struct rather than written twice, and a missing entry becoming a build error rather than a failed startup.
What a C++ team can actually point at when asked about memory safety
The question now arrives in procurement paperwork rather than in conference talks, and C++26 shipped without the profiles that were supposed to answer it. What exists today is less impressive and more useful: a hardened standard library measured at a fraction of a percent, sanitizers in CI, and warnings that catch the class of bug being asked about.
C++26 removes the initializer_list constructor of std::span
With the initializer_list constructor that C++26 had added, std::span<const bool> s{ptr, n} builds a two-element span of bools, and GCC 15 compiles it with a warning. P4144R1 removes the constructor, the 2026-03 LWG motion put that into the C++ working draft, and libstdc++ 16 and libc++ 23 no longer have it. Compiler Explorer runs show each library side by side.
C++26 lets you throw and catch at compile time
Until now a throw inside a constant expression was an immediate compile error, which forced constexpr code to report failure some other way. C++26 allows exceptions during constant evaluation: a throw that gets caught in the same evaluation is fine, and only an uncaught one fails the build. GCC 16.1 runs it today.
Signals, slots and thread affinity without Qt or moc
The core of reflect-moc is signals, slots, queued and blocking connections, thread affinity and a per-thread event loop in plain C++26 with no Qt. A worker thread reports progress to an object on the main thread, and the program runs on Compiler Explorer. Under ThreadSanitizer the 18 core tests passed in the recorded run, and one test reports in 27 of 11000 repeats, a report that a 12-line std::latch program without the library also gets and that a mutex and condition variable removes.
std::optional can finally hold a reference
std::optional<T&> was ill-formed for fourteen years, so everyone used a raw pointer and wrote a comment explaining that null means absent. C++26 makes it legal: rebinding assignment, no allocation, and a value type you can return. It compiles and runs on GCC 16.1 today, though libstdc++ has not yet set the feature-test macro.
std::function_ref borrows a callable instead of owning it
C++26 adds std::function_ref, the non-owning counterpart to std::function. It is the right parameter type for a callback you will invoke but not store: it copies nothing, allocates nothing, and binds equally to a capturing lambda or a plain function. It is to std::function what string_view is to string.
A Q_OBJECT that never names its class
RQT_OBJECT is written like Q_OBJECT: no class name, no base class template, no registration call. It finds its class by asking std::meta::current_function() for its parent from inside member functions defined in the class body. RQT_PROPERTY takes the exact Q_PROPERTY text, stringifies it and parses it with a consteval function, so a misspelled keyword stops the build with a message. A Qt-free reduction of both runs on Compiler Explorer.
A tiny ORM: struct to SQL via reflection
Diesel / Entity Framework ergonomics in C++: annotate a struct, generate CREATE TABLE, SELECT, INSERT, UPDATE, and a row-to-struct binder. No codegen tool, no intrusive macros.
What compile-time regex costs, measured
Moving work to compile time moves the bill there too. Including the CTRE header costs about three quarters of a second, and each distinct pattern adds to that. The library also declines some PCRE syntax and reports it through an error message that names the offset while wrapping it in template noise.
C++26 cannot write a signal's body, so a signal became a data member
A Qt signal is a function whose body moc generates, and C++26 reflection cannot generate a function body. A callable data member does not connect, a source_location tag gives every signal the same type, and a closure tag has internal linkage. What held is a bodyless data member that finds its owner through a hidden first member: 8 bytes per signal and 8 per class, measured. A static signal costs 0 bytes and has one silent pitfall. A signal that writes its own one-line body costs nothing and is the one form for overloaded signals.
views::concat iterates several containers as one range
C++26 adds std::views::concat, a view that presents several ranges as a single sequence without copying any of them. The containers can be different types holding the same elements, the result composes with every other adaptor, and GCC 16.1 ships it today.
The hardened standard library turns an out-of-bounds read into a stop
GCC checks an out-of-bounds vector::operator[] at -O0 and stops checking at -O2, so the build you debug is guarded and the build you ship is not. One macro carries the check into the optimised build: -D_GLIBCXX_ASSERTIONS for libstdc++, _LIBCPP_HARDENING_MODE for libc++, _MSVC_STL_HARDENING for the MSVC STL. Google has reported this class of hardening cut its production segfault rate by about a third.
Qt accepts a QMetaObject that C++26 reflection built
Qt 6.10 builds its meta-objects from constexpr tables, so a table made by C++26 reflection goes in the same place. Stock Qt connects, invokes, reads properties of, casts to and binds in QML a class that moc never saw, and a differential test finds its QMetaObject identical to the one moc generates. Four things had to be worked around, and a signal's declaration had to change.
One function that fills any struct from any pattern
A regex with N captures already describes a record with N fields, and C++26 reflection can enumerate a struct's fields. Joining them gives a parse_into<T, Pattern>() that fills any aggregate with no per-struct code, which builds and runs today on the reflection fork.
reflect_soa: AoS → SoA → AoSoA, one struct, three layouts
Corrected on 6 October 2026: reflect_soa is not a published library (its repository holds only a README), the embedded demo is a reduced hand-written stand-in, and the benchmark timings were never measured and are removed. The correction at the top has the details; the rest is kept as published.
Reflection across languages: C++26 vs Rust, C#, Java, TypeScript, Go, Python
Capstone: the canonical reflection tasks — serialize, enum↔string, CLI parsing, ORM row binding — side by side in seven mainstream languages. Where C++ lands, and what the uniquely-C++ angle actually gives you.
Replacing Qt's MOC with reflection
Qt's Meta-Object Compiler parses Q_OBJECT/Q_PROPERTY declarations and emits glue code. With C++26 reflection, Q_PROPERTY-equivalent becomes a library pattern — no external compiler, no generated files.
define_aggregate: synthesising types at compile time
TypeScript's Pick, Omit, and Partial have direct C++26 equivalents. define_aggregate lets you construct a new type from a list of member specs — opening up type-level programming that was previously pure metaprogramming wizardry.
Auto-generated mocks from interfaces
Corrected on 5 October 2026: reflection cannot generate the mock class this post describes, because define_aggregate adds data members and no functions. The correction at the top has the GCC errors; the rest is kept as published.
Autowired dependency injection: no container, just reflection
Spring's and .NET's DI containers, reimplemented as a 60-line C++26 library. Reflect constructor parameters, resolve them from a type registry, compose.
Clap for C++: turning structs into command-line parsers
Rust's clap-derive in C++: declare a struct, get a working argv parser with --flags, -short options, help text, subcommands. One attribute per field, zero manual dispatch.
One codegen, many wire formats
JSON, YAML, XML, TOML, MessagePack — all from the same annotated struct. Factor format-specific syntax into a policy object, share the reflection walk, ship N formats for the cost of one.
Deserialization and std::expected: completing the round-trip
Parse JSON into a typed C++ struct with precise per-field error reporting via std::expected. Reflection + template for + annotations — the same machinery, just running the other way.
Annotations: tag-driven serialization comes to C++
P3394 brings serde-style and Jackson-style attribute programming to C++: rename, skip, skip_if_empty, rename_all — all as plain user-defined values queryable by reflection.
A 40-line JSON serializer with reflection
Corrected on 6 October 2026: there is no reflect_json library, and the speed figures in the first version were not measured with a method I can show. The post walks a struct and emits JSON in about fifty lines, with no macros and no external codegen; the corrected measurement is in the Runtime cost section.
Four CppCon 2026 keynotes are already free to watch
CppCon 2026 closed on Friday and four keynotes are already on YouTube as unlisted prerelease links, including the first panel keynote the conference has run. The rest of the programme sits in paid Early Video Access for at least 30 days before the free drip to YouTube begins, one Main Program talk per business day.
WG21 now says new library types must ship a pmr alias
The worry that pmr is a C++17 experiment the committee abandoned is backwards. WG21's 2024 policy P3002 makes pmr the default vehicle for new allocating types, P1083 brings resource_adaptor in C++26, and P3153 makes optional allocator-aware. A live resource_adaptor demo bridges a classic allocator. Episode 8 of the pmr series.
Getting values out of a match
Numbered captures, named captures, and structured bindings that destructure a match directly. C++26 lets the binding itself be the condition, which removes the trailing test, though one compiler currently disagrees about that inside constant expressions.
C++29 mode is open, and the compilers already disagree
LLVM 23.1 shipped with -std=c++2d, a mode for the standard after C++26, and GCC trunk has one too. Both report __cplusplus as 202700. They do not agree about C++26 itself: GCC says 202603, which is the ratified value, and clang still says 202400.
LLVM 23.1 shipped, and one of its changes is silent
Clang 23.1 landed on 25 August with partial expansion statements, modules dependency discovery, and a batch of core-issue fixes. It also elides more dead stores than 22 did, which is the one change that alters behaviour without saying anything at build time.
Defaulting a destructor costs you both move operations
Howard Hinnant's table tells you which special member functions survive once you declare one yourself. C++26 reflection can check it rather than trusting it, and the result for a defaulted destructor is the one worth internalising: a line that looks like a no-op removes move construction and move assignment.
Who gets to say a feature is not ready
Contracts are in the C++26 working draft. The committee voted against removing them, decisively. Bjarne Stroustrup and four co-authors are asking again anyway, before the final ballot, on the grounds that counting votes is the wrong way to settle whether a foundational feature is finished. Both cases, from the papers.
A C++26 structured binding that GCC and Clang disagree about
C++26 lets a structured binding declaration be the condition of an if. GCC 16.1 and Clang 22.1 both implement it and both agree on ordinary structs. Put a tuple-protocol type in the condition and evaluate it at compile time, and GCC rejects the program while Clang accepts it. The reproducer is twenty lines and needs no library.
C++26 contracts, and the const rule the compiler makes you learn
Contracts are one of the four headline C++26 features and they run on GCC 16.1 today. Two things surprise people on first contact: a by-value parameter named in a postcondition must be const, and what a violation actually does is a compiler flag rather than a property of your code.
GCC 16.2 is out, LLVM 23.1 is nearly there, MSVC is still finishing C++23
GCC 16.2 shipped on 7 August with more than a hundred regression fixes and no new features. LLVM 23.1 reached its third release candidate on 12 August and has not shipped. MSVC has no C++26 date. If you want to write C++26 today, the practical answer remains GCC, and this is where each toolchain actually stands.
std::constant_wrapper carries a compile-time value as an argument
A template parameter is a compile-time value you cannot pass as an argument. A function argument is a runtime value you cannot use as a template parameter. C++26's std::constant_wrapper is an empty object that carries a compile-time value, so it crosses that line: arithmetic on it stays constant, and the result still works as an array extent. GCC 16.1 ships it.
Pattern matching did not make C++26
Enough people assumed pattern matching shipped in C++26 that it is worth stating plainly: it did not. P2688 missed the feature freeze and is now aimed at C++29, no shipping compiler implements it, and until then std::visit with an overload set remains the idiom. Here is what the proposal would actually give you.
Converting between std::function and copyable_function nests them
std::function and std::copyable_function are both type-erased callable wrappers and neither recognises the other. Converting between them does not unwrap and rewrap the lambda inside; it wraps the whole previous wrapper. Round-trip in a loop and every call walks a chain of indirections. In this run, 200 round trips made the same calls several hundred times slower.
std::indirect makes PImpl copyable without writing a copy constructor
PImpl with unique_ptr costs you the special members: hand-written copy operations, a destructor defined where Impl is complete, and const that stops at the pointer. C++26's std::indirect is an indirect value instead of an owning pointer, so it copies deeply and propagates const, and all five special members can be defaulted. GCC 16.1 ships it.
std::inplace_vector is a vector that never touches the heap
C++26 adds std::inplace_vector<T, N>, a sequence container with a fixed compile-time capacity whose storage lives inside the object. It gives you a vector's dynamic size and push_back with zero heap allocation, which is exactly what embedded, real-time, and hot-path code has been hand-rolling for decades. GCC 16.1 ships it now.
C++26 rewrote std::print's internals and backported the fix
std::print's per-call atomicity extends to your own types via std::formatter. How it stays both safe and efficient is a C++26 story: P3107 adds locking-aware entry points and a formatter opt-in to avoid deadlock, and ships as a backport into C++23. Episode 5 of the concurrent I/O series.
Three small C++26 string fixes you will use every day
C++26 quietly closes three long-standing paper cuts in the string library: you can finally write string + string_view, build a stringstream straight from a string_view, and construct a bitset from a view without a temporary. None of them are flashy, all of them remove a copy or a conversion you have been writing for years. Verified on GCC 16.1 and clang-p2996.
C++26 makes an uninitialized read a defined bug
Reading an uninitialized variable has been undefined behavior in C++ since the beginning, and compilers optimize on that assumption. C++26 (P2795) reclassifies it as erroneous behavior: still a bug the compiler diagnoses, but with a defined value and no licence for the optimizer to delete surrounding code. A poisoned-stack demo shows the same source printing garbage under C++23 and a defined 0 under C++26.
Why you can't std::format a smart pointer (and how to anyway)
A recent r/cpp question: std::cout << a unique_ptr works, but std::println("{}", that_unique_ptr) is ill-formed. There is no std::formatter for smart pointers. Is that an oversight? No -- it is a deliberate, sustained decision. Here is the why, and three ways to format a smart pointer today, all verified on Compiler Explorer.
Embed a file at compile time: #embed in C++26
Baking a file into a binary has meant a build step forever: xxd -i, a generated header, a CMake custom command that drifts. C++26 adopts C23's #embed, so a file becomes a literal the compiler reads at translation time. No codegen, no glue. Here it is running on Compiler Explorer.
Structured concurrency: what std::future never had
A std::future is a dead end: you launch it, you get() it once, and composing two of them means manual threads and locks. C++26 senders compose. when_all runs work concurrently and joins it into one result, with no mutex and no leaked threads. Here is the pattern, running on Compiler Explorer.
Hello, sender: your first std::execution pipeline
C++26 shipped three big things: reflection, contracts, and std::execution. The first two get the headlines on this blog. std::execution (P2300) is the new standard model for asynchronous and parallel work, and it is the one most codebases will reach for first. Here is the smallest pipeline that does real work, running today on Compiler Explorer.
reflect_tracing: zero-overhead spans on Maciek Gajewski's ring-buffer engine
Corrected on 6 October 2026: the library this post describes has not been published, and the timing figures in it were never measured. The note at the top says what the repository holds and what the embedded demo does. The rest is kept as published.
reflect_telemetry: compile-time Prometheus metrics from annotated fields
Corrected on 6 October 2026: the library this post describes has not been published, and its benchmark numbers were never measured. The note at the top says what the repository holds, what the embedded demo does and which code was fixed. The rest is kept as published.
reflect_dx: auto-generated debugger pretty-printers and docs
Corrected on 6 October 2026: reflect_dx is not a published library (its repository holds only a README), the two tools in this post do not exist, and reflection cannot read comments. The one working piece is a natvis snippet walk, which the embedded demo runs. The correction at the top has the details; the rest is kept as published.
Define your own function colors: compile-time caller checks with C++26 reflection
C++ already enforces function colors -- consteval, CUDA's __device__, Clang's [[clang::nonblocking]] -- but every one of them needed a compiler change. C++26's std::meta::current_function() (P3795R1) lets a callee reflect on its caller at compile time, so you can paint your own colors as a 20-line library: audio-thread safety, capability tokens, or architectural layers that refuse to compile when called from the wrong place. Here is the pattern, three professional uses, and exactly where it breaks.
reflect_optics: Haskell-style lenses for C++26
Corrected on 6 October 2026: reflect_optics is not a published library (its repository holds only a README), the embedded demo is a reduced stand-in with no pipe operator, and several code claims did not hold as written. The correction at the top has the details and the GCC results; the rest is kept as published.
Reflection + annotations for hashing: opt out of fields, not whole structs
Krystian Piekos's May 29 post on infotraining.pl shows the cleanest demo so far of P3394 annotations combined with P2996 reflection: opt structs into hashing with [[=hashable]], and opt individual fields out with [[=skipped_for_hash]]. The Hashable concept and the calculate_hash walker fit in 40 lines. No macros.
reflect_arbitrary: property-based test generators, inferred from your types
Corrected on 6 October 2026: reflect_arbitrary is not a published library (its repository holds only a README), the embedded demo is a reduced stand-in with a fixed-range random generator, and the printed shrinking output came from no test and is removed. The correction at the top has the details; the rest is kept as published.
reflect_llmschema: C++ functions to LLM tool-use schemas, at compile time
Corrected on 6 October 2026: reflect_llmschema is not a published library (its repository holds only a README), and the embedded demo is a reduced stand-in that prints a smaller JSON than this post shows. The correction at the top has the details and the real output; the rest is kept as published.
Could C++ handle an ABI break? The 2026 case
Two pieces dropped in the same week: Luis Caro Campos' CppCon 2025 talk arguing package managers make ABI breaks manageable, and an HFT University article claiming a 58x P99 latency gap between Rust's and C++'s stdlib. The ABI debate is back. Here is what both sides are saying, and what C++26 shipped despite the constraint.
The fastest JVM is the C++26 compiler
Koen Samyn's BeCPP talk used std::meta::substitute to transform Java bytecode into executable C++ at compile time. The compiler constant-folds the entire program. The loop doesn't run faster. It doesn't exist. This is reflection used not for serialization or enum-to-string, but as a compile-time metaprogramming substrate for building language interpreters.
C++ modules in 2026: import std works, import boost is coming, your IDE still can't
import std compiles on GCC 16.1, Clang 18+, and MSVC. Boost has a per-library module prototype showing 45% build-time reductions. But CMake support is still experimental, clangd needs a full rebuild on module changes, IntelliSense has been 'experimental' for seven years, and almost no libraries ship module definitions. For reflection users: PCH is faster than modules on GCC 16.1 today.
simdjson meets reflection: sb << my_struct at 6.8 GB/s
simdjson now ships a C++26 reflection backend: define SIMDJSON_STATIC_REFLECTION, and sb << my_struct serializes any aggregate at SIMD speed. The CITM Catalog benchmark hits 6.8 GB/s. Combined with P3394 annotations for rename/skip, this is the production JSON path the reflection series has been building toward.
The hidden cost of <meta> -- and the three-line fix
Vittorio Romeo measured what C++26 reflection actually costs: the <meta> header adds ~181ms per TU on GCC 16.1, but the reflection algorithm itself is ~0.07ms per enumerator. The header is 2500x more expensive than the logic. A three-line CMake PCH stanza cuts the header cost by 2.3x. Modules, surprisingly, make it worse.
C++ Safety State of the Union: May 2026
C++ in May 2026 has four conversations running at once: regulators (CISA, EU CRA) demanding memory-safety roadmaps; the committee fighting over how to respond (Hagenberg vote 19 profiles / 9 Safe C++ / 11 both); what actually shipped in C++26 (P2900 contracts, P3471 hardened stdlib, P2996 reflection); and what the industry actually deployed (Chrome MiraclePtr -57% UAF, Google's 0.3% perf-cost data, Apple libc++ safe-buffers). They don't talk to each other in public. This essay wires them. Pre-Brno (8-13 June) reading.
Revzin at C++Now: 'Reflection Is Only Half the Story' -- what generation looks like next
Barry Revzin's C++Now 2026 keynote (Mon 4 May, Aspen) landed the line the C++ reflection community has been circling for two years: C++26 reflection lets you OBSERVE -- the next question is what it looks like to GENERATE. The 90-minute talk is a tour of source-code-generation design space (macros, templates, Rust proc-macros, Swift macros, D mixins) and reads as the natural sequel to wro.cpp's whole 'Where this is heading' triptych framing.
The five most useful things C++26 reflection unlocks (in effort order)
C++26 reflection looks like it requires a PhD in template metaprogramming. It does not. Five concrete projects you can build with it, ranked from five minutes to weeks. Use this as a triage when picking your first reflection-powered project.
Is std::vector consteval or constexpr? A reader's question, answered
A colleague asked: 'Is std::vector consteval and not constexpr?' Short answer: no, but the intuition is right. Long answer: the constexpr/consteval/constinit trio, the transient-allocation rule, and why std::define_static_array exists.
Reflection in the wild: April 2026 in five links
Five things happened to C++26 reflection in April 2026: GCC 16.1, Glaze v7.2, a Revzin write-up, a Lemire/Thiesen JSON talk, and one honest list of what is still not shipping.
Auto-generating std::formatter<T> for any aggregate
Rust's #[derive(Debug)] in C++: make any struct printable via std::format and std::println by dropping in one partial specialisation of std::formatter. Nested types, containers, enum names — all handled.
Glaze v7.2 vs your hand-rolled JSON: a 30-line benchmark
Glaze v7.2 ships a P2996 backend that retires __PRETTY_FUNCTION__, lifts the 128-member cap, and serializes private members. Here is when you still write your own thirty lines -- and when one call wins.
Goodbye magic_enum: enum reflection done right
A reflection-driven enum↔string library in 30 lines. No __PRETTY_FUNCTION__ tricks, no compile-time range knob, no compiler-specific behaviour — and unbounded, including enum values beyond 128.
GCC 16.1 ships C++26 reflection -- your 30-line hands-on
GCC 16.1 dropped on 30 April 2026 with -freflection. C++26 was finalized at Croydon five weeks earlier. Here is a 25-line program you can compile and run today on your laptop.
template for: iterating reflections at compile time
Expansion statements (proposal P1306) unroll a loop at compile time, instantiating the body once per element. They are the natural partner of reflection — one loop, N specialisations.
C++26 is done -- five weeks since Croydon, here's what shipped
Five weeks ago WG21 voted C++26 to publication in Croydon. The dust has settled enough to take stock of what landed, what compiles today, and what it means for the wro.cpp reflection series.
Splicing: [: r :] and putting reflections back into code
Splicing is the inverse of ^^: it takes a std::meta::info and drops the referred entity back into your source. Types, expressions, template arguments, member accesses — all round-trippable.
Your first ^^: reflecting types and walking members
Hands-on introduction to C++26 reflection: the ^^ operator, std::meta::info, and walking struct members. We take the post-1 teaser apart and rebuild it from primitives.
C++26 Reflection: What changes, and why it matters
Part 1 of the C++26 reflection series. A 40-line JSON serializer nobody could write in C++ before 2026 — plus the strategic story of why static reflection changes the ecosystem.