r/cpp • • Mar 30 '26

Header units importing other header units should be removed from the standard

0 Upvotes

Header units are meant to speed up module migration, the idea is you write a named module, export import a header unit and just use the named module.

Header units importing other header units serve no purpose other than damaging tooling.

It should be removed from the standard so people can actually implement the tooling in a sane way.


r/cpp • • Mar 29 '26

C++20 Coroutines Optimization Opportunities from Compiler’s perspective

Thumbnail chuanqixu9.github.io
34 Upvotes

r/cpp • • Mar 29 '26

Organizing C++ Module Sources

Thumbnail abuehl.github.io
16 Upvotes

A quote from the blog:

The source files for a specific partition are now grouped together into a dedicated sub-directory.

Thanks in advance for your comments to this blog posting!


r/cpp • • Mar 29 '26

C++ feature for DI/DIP/OCP with the widest cross-language analogue

11 Upvotes

the abstract base class interface(ABCI) via pure virtual functions is perhaps the 1st. (apart from the C style function pointer). it is analogues to type, abstract in fortran, and dyn Trait in rust and ABC / Protocol in python

sometimes due to performance considerations in compiled languages, one needs to switch to the compile time alternatives. in cpp the most common one is template(used with concept) which is close to T: Trait in rust and interface in fortran.

Do you think ABCI and template+concept are the 1st and 2nd best in cpp? what else?


r/cpp • • Mar 28 '26

Report from the Croydon 2026 ISO C++ Committee meeting - mp-units

Thumbnail mpusz.github.io
120 Upvotes

C++26 is done! 🎉

This means that WG21 groups were able to start the work on C++29 features. We made a significant progress on standardizing quantities and units. Read more to learn more...


r/cpp • • Mar 28 '26

Meeting C++ From Introductory to Advanced C++ - Learning Guidelines - Slobodan Dmitrovic - Meeting C++ 2025

Thumbnail youtube.com
16 Upvotes

r/cpp • • Mar 28 '26

Evolving a Translation System with Reflection in C++

Thumbnail friedkeenan.github.io
17 Upvotes

r/cpp • • Mar 28 '26

My experience writing build system for C++

20 Upvotes

So, I was writing a build system last month, it was a very good learning experience.

I want explain the general procedure for anyone interested.

1 - You extract build information from some file/script whatever

2 - You parse that information to a graph, run a topo sort, write a ninja file and save build info to a cache.

3 - You generate all your sources

4 - Ninja calls some cli tools for p1689 generation and to scan all your c++ sources and write rsp files and a global dyndep file.

5- You use rsp files to compile sources and dyndep file to manage build order

Some notes:

Header units aren’t supported, by anything. Clang driver for them is buggy and scan deps for them don't work. I think they must be removed from the standard because after 6 years no one really adopted them.

Static typed scripting is awesome, I used umka for my build system and the api just matches what I write in C++.


r/cpp • • Mar 27 '26

How Boost.Asio and Boost.Serialization powered a reinforcement learning cognitive radio on the ISS

Thumbnail boost.org
57 Upvotes

Penn State researchers (in collaboration with WPI and NASA Glenn) needed to deploy a multi-objective RL cognitive engine aboard the International Space Station. A C++ system capable of autonomously tuning radio parameters in real time across six competing objectives: bit error rate, throughput, spectral efficiency, transmit power efficiency, occupied bandwidth, and DC power consumption.

Two Boost libraries ended up being load-bearing:

Boost.Asio handled concurrent UDP listeners and raw Ethernet frame transmission to two different modem interfaces simultaneously: a ViaSat DVB-S2 receiver for telemetry and an ML605 transmitter for embedding action tuples into AOS uplink frames. The same networking code ran on ground workstations and space-target platforms with minimal porting effort. Critical constraint: 40ms round-trip window between ground and orbit.

Boost.Serialization solved a harder problem: each ISS pass over a ground station lasts only a few minutes. The question was whether a cognitive engine that retains its neural network weights and training buffer between passes outperforms one that relearns from scratch every contact window. Boost.Serialization made it possible to archive and restore the complete state of the RL system (weights, buffer, params) to human readable text files, resuming with full learned context on each new pass.

There's also an under appreciated angle here: licensing. The software was destined for NASA's STRS Repository under ITAR/export control restrictions. GPL and LGPL were off the table entirely. Boost's permissive license was genuinely a deciding factor, not an afterthought.

A secondary observation from the project: both MLPack (their NN library) and Armadillo (matrix algebra) also depend on Boost internally. When your whole stack trusts the same foundation, dependency conflicts and build complexity go down measurably.

To the authors' knowledge, one of the first published demonstrations of a cognitive engine operating on a space based asset.


r/cpp • • Mar 27 '26

HPX Tutorials: Task Scheduling and Custom Executors

Thumbnail youtube.com
9 Upvotes

HPX is a general-purpose parallel C++ runtime system for applications of any scale. It implements all of the related facilities as defined by the C++23 Standard. As of this writing, HPX provides the only widely available open-source implementation of the new C++17, C++20, and C++23 parallel algorithms, including a full set of parallel range-based algorithms. Additionally, HPX implements functionalities proposed as part of the ongoing C++ standardization process, such as large parts of the features related parallelism and concurrency as specified by the C++23 Standard, the C++ Concurrency TS, Parallelism TS V2, data-parallel algorithms, executors, and many more. It also extends the existing C++ Standard APIs to the distributed case (e.g., compute clusters) and for heterogeneous systems (e.g., GPUs).

HPX seamlessly enables a new Asynchronous C++ Standard Programming Model that tends to improve the parallel efficiency of our applications and helps reducing complexities usually associated with parallelism and concurrency.
In this video, we explore how to utilize HPX capabilities for execution strategies, detailing how executors can be used to control how, when, and where tasks run without manually managing threads. We focus on the implementation of the main executor types—Parallel, Fork-Join, and Sequential—demonstrating their performance trade-offs through a practical analysis of the LULESH hydrodynamics benchmark. The tutorial details the creation of a custom annotating executor, utilizing tag_invoke to customize post and sync_execute operations, ensuring that tasks can be reliably tagged for debugging and profiling. This provides a clear introduction to extending the unified executor API, culminating in integrating this custom executor with parallel algorithms like hpx::for_each, where we illustrate how to seamlessly track concurrent tasks while maintaining high-performance execution.
If you want to keep up with more news from the Stellar group and watch the lectures of Parallel C++ for Scientific Applications and these tutorials a week earlier please follow our page on LinkedIn https://www.linkedin.com/company/ste-ar-group/ .
Also, you can find our GitHub page below:
https://github.com/STEllAR-GROUP/hpx
https://github.com/STEllAR-GROUP/HPX_Tutorials_Code


r/cpp • • Mar 27 '26

C++26: A User-Friendly assert() macro

Thumbnail sandordargo.com
53 Upvotes

r/cpp • • Mar 27 '26

C++20 Coroutines Optimization Opportunities from Compiler's perspective

43 Upvotes

r/cpp • • Mar 26 '26

P3054 - Quantities and Units Library

79 Upvotes

Today I delivered an Evening Session to the ISO C++ Committee on the Quantities and Units Library, which is under consideration for standardization as part of C++29. Nothing is sure for now, but fingers crossed 🤞

If you want to learn more about the proposal itself, please check the paper P3045. However, I really like the slides I presented today, so I decided to share them with you immediately as well. You can find them in my GitHub repo. Please review them, try the workshops (just click the QR code in the corner), experiment, and share feedback.


r/cpp • • Mar 26 '26

CLion 2026.1 Is Here

Thumbnail blog.jetbrains.com
42 Upvotes

r/cpp • • Mar 26 '26

Module partitions can be tricky to use. How tricky do they need to be?

17 Upvotes

Which code example would you prefer? (If you could choose...)

Example A

// file bar.cppm
export module foo:bar;
...

// file bar1.cpp
module foo:bar.impl1;
import :bar;
...

// file bar2.cpp
module foo:bar.impl2;
import :bar;
...

Note: Neither foo:bar.impl1 nor foo:bar.impl2 are imported anywhere, so generating a BMI file for these is pointless.

Example B

// file bar.ixx
export module foo:bar;
...

// file bar1.cpp
module foo:bar;
...

// file bar2.cpp
module foo:bar;
...

Example A is what is currently supported by the C++ standard.

Example B is what is possible using the current implementation of the Microsoft C++ compiler (not yet in the standard).

Both variants achieve the same goal.

Which version do you think is easier to understand?

Previous related posts:


r/cpp • • Mar 25 '26

IResearch (C++ search engine lib) outperforms Lucene and Tantivy on every query type in the search-benchmark-game

Thumbnail github.com
59 Upvotes

I've been a maintainer of IResearch (Apache 2.0) since 2015. It's the C++ search core inside ArangoDB, but it's been largely invisible to the wider C++ community.

We recently decoupled it and ran it through the search-benchmark-game created by the Tantivy maintainers. It's currently winning on every query type (term, phrase, intersection, union) for both count and top-k. 

Benchmark methodology: 60s warmup, single threaded execution, median of 10 runs, fixed random seed, query cache disabled. The benchmark is reproducible: clone, run `make bench`, get the same numbers.

The gains come from three places: 

Interactive results: https://serenedb.com/search-benchmark-game

If you're building something in C++ that needs search, IResearch is embeddable today. Happy to help you get started.

Repo: https://github.com/serenedb/serenedb/tree/main/libs/iresearch

Upd: Tantivy published results to their repo https://tantivy-search.github.io/bench/


r/cpp • • Mar 25 '26

Meeting C++ Announcing Meeting C++ 2026!

Thumbnail meetingcpp.com
24 Upvotes

r/cpp • • Mar 25 '26

[ninja build] Trailing whitespace in NINJA_STATUS from CMakePresets.json?

5 Upvotes

My scenario is driving CMake+Ninja from Visual Studio using CMake presets. I have a preset file that includes something like the following:

    "buildPresets": [
        {
            "name": "x64-msvc-debug",
            "displayName": "x64 Debug (msvc)",
            "configurePreset": "x64-msvc-debug",
            "environment": { "NINJA_STATUS": "[%p / %e] " }
        }
    ]

That all works as expected.. except for that very tiny, but oh-so-annoying, detail that the trailing whitespace gets trimmed away somewhere along the line leaving me with build outpute that looks like this:

[ 18% / 0.303]Building C object...

What's even more annoying is that the official Ninja docs make a point of noting that trailing whitepace for separation. I've tried a bunch of random ways of forcing this, from quoting and escaping to invisible unicode characters, but nothing sticks so far.

I'm sure it's gonna turn out to be something incredibly easy and stupid, but I'd love to know how to convince the machinery to keep my status string intact.

Wasn't really sure whether this will turn out to be an issue from Visual Studio, CMake, or Ninja in the end, but I'm hoping there's enough Ninja users here that someone might have seen the same issue.


r/cpp • • Mar 24 '26

Optimizing a Lock-Free Ring Buffer

Thumbnail david.alvarezrosa.com
106 Upvotes

r/cpp • • Mar 24 '26

Dear ImGui Explorer

74 Upvotes

Dear ImGui Explorer (which was previously named Dear ImGui Manual) is an online "ImGui::ShowDemoWindow", together with an instant access to all demos source code.

A new version was recently, so I figured it might be worse mentioning here, since this new version also adds support for ImPlot and ImPlot3D demos.

Disclaimer: I am the author of this tool.


r/cpp • • Mar 26 '26

How is the vibe coding adaption of C++

0 Upvotes

I am a non coder who is doing programming in Python using Vibe coding. Python + vibe coding is currently enough for me to do the basic tests on hardware I am developing without relying on the actual coders to do it, it reduces their burden as they have other projects to work on as well. Next step is developing the software from the basic python logic and frame work I provide, for which the coder in team says it takes time to implement on C++ compared to python as it direct libraries while C++ does not. I want to help them out doing vibe coding for C++ but not sure if that will help them or will create more burden to clean up what I vibe code.


r/cpp • • Mar 24 '26

Latest News From Upcoming C++ Conferences (2026-03-24)

13 Upvotes

This is the latest news from upcoming C++ Conferences. You can review all of the news at https://programmingarchive.com/upcoming-conference-news/

TICKETS AVAILABLE TO PURCHASE

The following conferences currently have tickets available to purchase

OPEN CALL FOR SPEAKERS

There are currently no open calls.

OTHER OPEN CALLS

There are currently no open calls.

TRAINING COURSES AVAILABLE FOR PURCHASE

Conferences are offering the following training courses:

Eleven of these workshops had previews at the main C++Online Conference which took place on the 11th – 13th March. You can watch these preview sessions here: https://www.youtube.com/playlist?list=PLHG0uo5c6V3KIeoLqvBbIqy5AXt_Me_cm

Anyone who purchased a C++Online Main Conference ticket can also get a discount of however much they paid to attend the main conference. 

OTHER NEWS


r/cpp • • Mar 24 '26

Understanding Safety Levels in Physical Units Libraries - mp-units

Thumbnail mpusz.github.io
32 Upvotes

Physical quantities and units libraries exist primarily to prevent errors at compile time. However, not all libraries provide the same level of safety. Some focus only on dimensional analysis and unit conversions, while others go further to prevent representation errors, semantic misuse of same-dimension quantities, and even errors in the mathematical structure of equations.

This article explores six distinct safety levels that a comprehensive quantities and units library can provide. We'll examine each level in detail with practical examples, then compare how leading C++ libraries and units libraries from other languages perform across these safety dimensions. Finally, we'll analyze the performance and memory costs associated with different approaches, helping you understand the trade-offs between safety guarantees and runtime efficiency.

We'll pay particular attention to the upper safety levels—especially quantity kind safety (distinguishing dimensionally equivalent concepts such as work vs. torque, or Hz vs. Bq) and quantity safety (enforcing correct quantity hierarchies and scalar/vector/tensor mathematical rules)—which are well-established concepts in metrology and physics, yet remain widely overlooked in the C++ ecosystem. Most units library authors and users simply do not realize these guarantees are achievable, or how much they matter in practice. These levels go well beyond dimensional analysis, preventing subtle semantic errors that unit conversions alone cannot catch, and are essential for realizing truly strongly-typed numerics in C++.


r/cpp • • Mar 24 '26

Rewriting a FIX engine in C++23: what got simpler (and what didn't)

67 Upvotes

I spent a few months building a FIX protocol engine from scratch in C++23. Not because the world needed another one, but because I wanted to see how far modern C++ can take a FIX engine compared to QuickFIX.

QuickFIX was written by people who knew what they were doing. It also reflects the constraints and tooling available at the time. But it's very much C++98/03 era code: custom object pools, hand-rolled lock-free queues, manual cache line alignment. A lot of infrastructure that today overlaps with standard or near-standard tools.

The surprising part was how much of that code simplifies with C++23.

The original object pool was ~1000 lines of allocation logic. In the new version that's std::pmr::monotonic_buffer_resource with per-message reset.

Tag lookup went from a large switch with 50+ cases to a consteval table computed at compile time, O(1) at runtime with no branches.

Delimiter scanning went through three SIMD approaches (intrinsics, Highway, xsimd). Ended up going with xsimd. Maintaining separate AVX2/AVX-512 paths wasn't worth the extra complexity for ~5% throughput.

Current result (microbenchmarked with RDTSC, single-core, warmed cache, using synthetic FIX messages): ExecutionReport parse ~246 ns vs ~730 ns for QuickFIX on the same input, over 100K iterations.

No heap allocations on the hot path.

Not production-ready yet, but the parser and session layer are stable enough to compare.

A couple of things still being figured out:

  • Header-only at ~5K LOC. Compiles fine locally, but not sure where CI starts to struggle
  • Only covering 9 FIX message types so far. Interested in any edge cases people have run into

https://github.com/StratCraftsAI/NexusFix