// all entries

Posts

Flagship technical posts and short-form community items, newest first.

/short

A new proposal deletes your enum bitmask boilerplate

Every C++ codebase that uses a scoped enum as a flag set writes the same eight operator overloads by hand, just to get |, &, and ~ back. P4313 in the 2026-07 mailing proposes an opt-in attribute, enum class [[std::bitmask_type]], that generates all of it and keeps each bitmask a distinct type. Here is the boilerplate it removes, running today.

  • #news
  • #wg21
  • #enums
  • #proposal
/flagship/concurrent-io 05/18

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.

  • #concurrency
  • #print
  • #format
  • #cpp26
/short

Google Benchmark runs live on Compiler Explorer

You do not need a local build to run a real microbenchmark. Add the benchmark library on Compiler Explorer, turn on execution, and Google Benchmark prints its timing table in the output pane. The demo is also the first lesson every microbenchmark teaches: without benchmark::DoNotOptimize the compiler deletes the loop you are trying to measure and reports a time near zero.

  • #news
  • #benchmarking
  • #performance
  • #tooling
/flagship/concurrent-io 04/18

std::print does not tear the way std::cout does

The fixes so far needed cooperation or a lock. C++23's std::print gives per-call atomicity for free: a single print call never interleaves with another, the way printf never did and std::cout always could. But the guarantee is per-call, so a line split across two calls can still tear. Episode 4 of the concurrent I/O series.

  • #concurrency
  • #print
  • #iostreams
  • #cpp23
/short

The sanitizers run live on Compiler Explorer

AddressSanitizer, UndefinedBehaviorSanitizer, and ThreadSanitizer all run in Compiler Explorer's execution pane. Add one -fsanitize flag, turn on execution, and the runtime report prints in the browser: the faulting line, the allocation site, the shadow-byte map, both racing stacks. There is no cheaper way to show a colleague exactly why a bug is a bug.

  • #news
  • #tooling
  • #sanitizers
  • #debugging
/flagship/concurrent-io 03/18

static std::mutex is safe to construct, thanks to magic statics

Before osyncstream, the fix for a shared log sink was a static std::mutex. But is the static mutex itself safe to initialize under threads? Yes, thanks to C++11 magic statics: a function-local static is constructed exactly once even under a stampede. With the mutex-versus-osyncstream trade-off. Episode 3 of the concurrent I/O series.

  • #concurrency
  • #threads
  • #mutex
  • #cpp11
/flagship/concurrent-io 02/18

std::osyncstream makes concurrent output atomic

std::cout garbled its own output across threads. C++20's std::osyncstream fixes it: each thread buffers a line privately and emits it to the stream atomically on destruction. One wrapper, whole lines, with one sharp edge: the guarantee holds only if every writer uses it. Episode 2 of the concurrent I/O series.

  • #concurrency
  • #iostreams
  • #syncstream
  • #threads
/short

std::flat_map is just two vectors

C++23's std::flat_map is an adaptor over a sorted vector of keys and a parallel vector of values. That buys cache-friendly lookups and near-zero memory overhead, and costs O(n) insertion and aggressive iterator invalidation. It replaces std::map, not std::unordered_map, and knowing which vector trick it is tells you exactly when to reach for it.

  • #news
  • #cpp23
  • #containers
  • #performance
/flagship/concurrent-io 01/18

Your std::cout logging has no data race and still tears

Qt's message-handler contract says the handler must be reentrant: called from many threads at once. Point it at std::cout and the output tears, even though the C++ standard guarantees no data race. 'No data race' and 'no interleaving' are different promises, and this series closes the gap. Episode 1 of the concurrent I/O series.

  • #concurrency
  • #iostreams
  • #logging
  • #threads
/short

The syscall behind C++ asymmetric fences

Asymmetric fences let you pay for a memory barrier only on the rare path. The common path gets a free compiler barrier; the uncommon path calls Linux membarrier(), which forces every other thread to run a full fence for you. Ryan Chung Yi Sheng's deep-dive follows the idea from the C++ standard down to the kernel, and finds a possible crack in the wording along the way.

  • #news
  • #concurrency
  • #atomics
  • #memory-model
/short

Less standard library, faster program

Jussi Pakkanen (creator of Meson) rewrote a subset of the C++ standard library from scratch, dropping ISO conformance to chase compile speed. Converting his real CapyPDF library to it cut compile time ~80% and binary size ~75%, and made the program ~25% faster, with no runtime penalty for the faster build.

  • #news
  • #build-times
  • #standard-library
  • #performance
/short

One word, final, turns a virtual call into two instructions

A C++ Weekly episode reminded everyone of a free win: marking a class final lets the compiler devirtualize. We took the canonical example to GCC 16.1 at -O2 and read the actual assembly. Without final, GCC hedges with a runtime vtable check; with final, the whole call folds to mov eax, 42; ret. The asm is the proof.

  • #cpp
  • #performance
  • #devirtualization
  • #final
/short

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.

  • #cpp26
  • #stdlib
  • #string
  • #string_view
/short

How the C++ community is actually using AI in 2026

The question in the C++ world has shifted from whether to use LLMs to how to use them well. A roundup of where that conversation is right now: Jason Turner's three-part C++ Weekly arc on getting useful code out of AI, CppCast on teaching C++ in the LLM era, and Herb Sutter asking the uncomfortable question about agents doing harm.

  • #news
  • #ai
  • #llm
  • #workflow
/short

CppCon 2026 puts three language designers on one stage

CppCon 2026 (Sep 12-18, Aurora CO) will host the conference's first-ever keynote panel: Bjarne Stroustrup (C++), Guido van Rossum (Python), and Mads Torgersen (C#) on one stage. Three creators of three of the most-used languages alive, comparing notes on where their languages are headed.

  • #news
  • #community
  • #cppcon
  • #conferences
/short

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.

  • #news
  • #cpp26
  • #safety
  • #undefined-behavior
/short

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.

  • #format
  • #smart-pointers
  • #cpp26
  • #news
/short

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.

  • #embed
  • #cpp26
  • #preprocessor
  • #news
/short

Gor Nishanov (1971-2026), who gave C++ its coroutines

Gor Nishanov, the architect of C++20 coroutines, has died at 54. From the 2014 resumable-functions papers to shipping implementations in MSVC and Clang, he spent the better part of a decade turning co_await into a standard language feature. Herb Sutter remembered him as intelligent and witty, but above all kind.

  • #news
  • #community
  • #coroutines
  • #history
/short

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.

  • #execution
  • #async
  • #senders
  • #cpp26
/short

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.

  • #execution
  • #async
  • #senders
  • #cpp26
/flagship/cpp26-reflection 24/18

reflect_tracing: zero-overhead spans on Maciek Gajewski's ring-buffer engine

Tracing and metrics split into sibling libraries: reflect_telemetry for aggregates over time, reflect_tracing for spans at microsecond resolution. The engine is Maciek Gajewski's 2021 Wro.cpp technique — thread-local ring buffers, ~200 ns per span, function address as payload, DWARF resolution at dump time. Reflection contributes the instrumentation layer, which today is one explicit scope-guard line per function and tomorrow (C++29, P3294/P3157) becomes a pure annotation.

  • #reflection
  • #cpp26
  • #tracing
  • #perfetto
/flagship/cpp26-reflection 23/18

reflect_telemetry: compile-time Prometheus metrics from annotated fields

Every microservice has hand-registered counter() lines that drift from the variable they count. Annotate a field [[=metric(counter)]] and let reflection emit the Prometheus exposition + OpenTelemetry OTLP exporter, keeping names in lockstep with code. Genuinely novel — nobody is doing this yet.

  • #reflection
  • #cpp26
  • #telemetry
  • #prometheus
/flagship/cpp26-reflection 22/18

reflect_dx: auto-generated debugger pretty-printers and docs

Every C++ shop writes .natvis files by hand and they go stale. Every C++ shop wishes their headers were documented but can't face Doxygen XML. reflect_dx ships as a build-step tool: walk your headers with reflection, emit LLDB / GDB / Visual Studio pretty-printers + markdown docs. Your struct is your documentation and its debugger visualisation.

  • #reflection
  • #cpp26
  • #debugger
  • #lldb
/short

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.

  • #news
  • #cpp26
  • #reflection
  • #p2996
/flagship/cpp26-reflection 21/18

reflect_optics: Haskell-style lenses for C++26

Haskell's lens library has been the gold standard for nested data access for fifteen years. Ports to C++ needed macro hell and never felt right. Reflection makes the pattern genuinely tractable. field<"address.city">(person) is now a first-class, zero-overhead, type-safe, composable lens.

  • #reflection
  • #cpp26
  • #optics
  • #lens
/short

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.

  • #news
  • #cpp26
  • #reflection
  • #p2996
/flagship/cpp26-reflection 20/18

reflect_arbitrary: property-based test generators, inferred from your types

QuickCheck in Haskell, mockall in Rust, jqwik in Java — every major language auto-derives Arbitrary<T> from a struct declaration. C++ was last. Reflection fixes that: reflect the struct, recurse into field types, emit a generator. RapidCheck and FuzzTest adapters included.

  • #reflection
  • #cpp26
  • #testing
  • #quickcheck
/short

std::rotate: how libstdc++ and libc++ actually differ

Raymond Chen's June 2026 series on The Old New Thing exposed a surprising fact: libstdc++ and libc++ implement std::rotate with completely different algorithms. libstdc++ swaps left-to-right and ends at n-1 swaps with good locality. libc++ decomposes the rotation into gcd(a, n) cycles and hits ~n/2 swaps but with poor locality. Which is faster depends entirely on your input shape.

  • #news
  • #cpp
  • #stdlib
  • #libcxx
/flagship/cpp26-reflection 19/18

reflect_llmschema: C++ functions to LLM tool-use schemas, at compile time

In the AI agent era every tool you expose to Claude/GPT needs a JSON-Schema description. Today you write it by hand next to the C++ function. With C++26 reflection, a single consteval call emits the tool-use JSON at compile time — parameter names, types, docstrings, dispatch, done.

  • #reflection
  • #cpp26
  • #llm
  • #openai
/short

Profiles take shape, and the contract C++26 left behind comes back

The other half of the Brno safety story: a profiles framework with real syntax (attributes, not pragmas) plus two concrete profiles from Stroustrup, and P3097 bringing virtual-function contracts back after they were cut from the C++26 MVP. All target C++29.

  • #news
  • #cpp
  • #wg21
  • #brno
/short

Five small C++29 papers from Brno you will actually use

Underneath the safety headlines, WG21 Brno cleared a stack of small papers that working programmers will feel every day: designated-initializers that reach through a base class, a map .get() that does not insert, defaultable postfix operators, constexpr pointer tagging (which quietly leans on reflection), and mandatory intptr_t. All target C++29.

  • #news
  • #cpp
  • #wg21
  • #brno
/short

C++ is writing down all of its undefined behavior

The structural move at WG21 Brno was not a feature -- it was a catalogue. P3596 adds two annexes that enumerate every case of undefined behavior and every ill-formed-no-diagnostic-required corner in the standard, and P3100 turns that list into a case-by-case program to close each one for C++29. There are exactly 80 core-language UB cases, and 70% of them are memory-safety bugs.

  • #news
  • #cpp
  • #wg21
  • #brno
/short

WG21 Brno: with C++26 done, the committee turns to undefined behavior

The WG21 Brno meeting (June 8-13, 2026) was the first since C++26 was finalized, and per Herb Sutter's trip report the theme is unmistakable: catalogue and eliminate undefined behavior, push memory-safety profiles toward C++29, and finish the pieces the C++26 MVP deferred. Reflection, the headline of C++26, was not on the marquee -- and that is exactly what shipping looks like.

  • #news
  • #cpp
  • #wg21
  • #brno
/short

CUDA 13.3: tile programming in C++ without the boilerplate

NVIDIA CUDA 13.3 (May 26) adds C++ tile programming: declarative tile abstractions replace manual shared memory, synchronization, and indexing. CompileIQ autotuning uses evolutionary algorithms to tune tile sizes and memory layout per kernel (up to 15% speedup on GEMM/attention). Works on Hopper and all other supported architectures.

  • #news
  • #cuda
  • #gpu
  • #performance
/short

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.

  • #news
  • #cpp26
  • #abi
  • #stdlib
/short

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.

  • #news
  • #cpp26
  • #p2996
  • #reflection
/short

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.

  • #news
  • #cpp26
  • #modules
  • #import-std
/short

C++: The Documentary is now on YouTube

CultRepo's 'C++: The Documentary' had its world premiere on May 28 in New York and is now available worldwide on YouTube. The film traces C++ from Bell Labs in 1979 through the language's role in modern infrastructure. Sponsored by Hudson River Trading.

  • #news
  • #community
  • #history
  • #documentary
/short

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.

  • #news
  • #cpp26
  • #p2996
  • #simdjson
/short

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.

  • #news
  • #cpp26
  • #p2996
  • #meta
/short

The May 2026 WG21 mailing in five papers (pre-Brno, 116 total)

WG21 dropped the pre-Brno mailing in early May -- 116 papers, the largest pre-meeting mailing since the C++20 design crunch. Five papers are doing the heavy lifting for C++29's safety story (the headline axis named in P5000R1 'Direction for ISO C++29'), plus the coroutines-for-I/O work that finally got first LEWG review on the schedule. This is the table of contents for what wro.cpp will be tracking through to Brno (8-13 June).

  • #news
  • #wg21
  • #cpp29
  • #profiles
/short

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.

  • #news
  • #cpp26
  • #cpp29
  • #safety
/short

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.

  • #news
  • #cpp26
  • #cpp29
  • #reflection
/short

What reinterpret_cast doesn't do: Fertig on std::start_lifetime_as and the C++23 escape hatch

Andreas Fertig's 2026-05-18 post (re-shared on isocpp.org) makes a pointed case: reinterpret_cast and std::start_lifetime_as look interchangeable -- but only if you don't read the abstract-machine fine print. reinterpret_cast is a POINTER operation; std::start_lifetime_as is an OBJECT-LIFETIME operation. The 5-line difference between UB-then-it-works-on-my-compiler and defined-behavior.

  • #news
  • #cpp23
  • #reinterpret-cast
  • #start-lifetime-as
/short

Sutter's BeCPP keynote: C++ added more developers in 4 years than any other language

Herb Sutter's keynote at the BeCPP Symposium 2026 (March 30, Howest, Belgium) opened with a SlashData chart almost nobody outside the room has seen yet: C++ developer population grew 72% from Q1 2022 to Q1 2025 -- from 9.5M to 16.3M. That is the biggest absolute net gain of any general-purpose language over the period. Rust grew faster in percentage (137%) but on a smaller base (5.1M total). Here is the chart, the numbers behind it, and the thesis Sutter built on top -- plus an honest read on what 'fastest growing' means when JavaScript is still bigger than the second + third place combined.

  • #news
  • #cpp
  • #growth
  • #slashdata
/short

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.

  • #cpp26
  • #p2996
  • #reflection
  • #opinion
/short

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.

  • #cpp26
  • #constexpr
  • #consteval
  • #constinit
/short

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.

  • #cpp26
  • #p2996
  • #news
  • #roundup
/flagship/cpp26-reflection 06/18

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.

  • #reflection
  • #cpp26
  • #formatter
  • #debug-print
/short

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.

  • #cpp26
  • #p2996
  • #glaze
  • #json
/flagship/cpp26-reflection 05/18

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.

  • #reflection
  • #cpp26
  • #enum
  • #magic_enum
/short

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.

  • #reflection
  • #cpp26
  • #gcc
  • #p2996
/flagship/cpp26-reflection 04/18

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.

  • #reflection
  • #cpp26
  • #expansion-statements
  • #p1306
/short

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.

  • #cpp26
  • #p2996
  • #reflection
  • #contracts
/flagship/cpp26-reflection 03/18

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.

  • #reflection
  • #cpp26
  • #splicer
  • #p2996
/flagship/cpp26-reflection 02/18

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.

  • #reflection
  • #cpp26
  • #fundamentals
  • #p2996
/flagship/cpp26-reflection 01/18

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.

  • #reflection
  • #cpp26
  • #motivation
  • #p2996