r/cpp • • Feb 16 '26

Sourcetrail (Fork) 2025.12.8 released

37 Upvotes

Hi everybody,

Sourcetrail 2025.12.8, a fork of the C++/Java source explorer, has been released with these changes:

  • C++: Add indexing of structured binding declarations
  • C++: Add indexing of auto prvalue casts
  • GUI: Fix error/status view not cleared between indexing
  • C/C++: Replace msvc mulitithreading library switches with corresponding clang switches
  • C/C++: Add Visual Studio 2026 support
  • Database: Enable simple database performance improvement

r/cpp • • Feb 17 '26

Pushback on the C++ memory ordering model

0 Upvotes

How many people are there in the world who feel they have a thorough understanding of the Standard C++ memory ordering model? It seems both unnecessarily elaborate, but also too vague. It seems much more straightforward to specify that memory write events are caused by one thread, but occur in all threads, just not necessarily in the same order. Fenced atomic writes and standalone fences in the causing thread restrict the ordering of the memory writes it causes in other threads. I took a stab at trying to write something up: https://wkaras.github.io/CppMemOrder.html . Feedback welcome.


r/cpp • • Feb 15 '26

CppCon Back to Basics: Iterators in C++ - Nicolai Josuttis - CppCon 2023

Thumbnail youtube.com
42 Upvotes

r/cpp • • Feb 16 '26

How I Feel About Toolchain Management in C/C++

0 Upvotes

I’ve spent most of the last two years working on toolchain management.

I started C/C++ development three years ago with CLion on Windows. Very early on, I ran into issues with the built-in package manager. I still remember how frustrating it was — it took almost a week just to install libcurl. After that, I moved to Visual Studio, but I continued to struggle with dependency management and various bugs.

So I switched to CMake with Visual Studio Code. Around that time, a new editor called Zed appeared, and I switched to that as well. Then I replaced cl.exe with clang-cl because I wanted to experiment with cross-compilation. That attempt failed badly. At the time, I was mostly adding dependencies as CMake subdirectories, but some libraries — like GTK — weren’t accessible that way. I also couldn’t get Emscripten or Qt apps working properly.

I then moved to XMake and maintained a dual setup with MinGW and MSVC using XMake’s global package manager. Eventually, I wanted to cross-compile to Linux, but I had constant issues building dependencies, and XMake’s documentation was extremely poor. I spent a huge amount of time trying to make cross-compilation work and grew increasingly frustrated.

Eventually, I gave up and switched back to CMake. Somehow, I managed to cross-compile an SDL/ImGui app to Linux and continued building from there. I also wanted macOS cross-compilation, but CMake on Windows caused issues, so I set up WSL for a while.

After some time, I grew tired of Windows altogether and moved to Linux. Some people suggested Arch, but I installed Linux Mint instead. On Linux, I spent a long time recreating my Windows setup on a single host system.

At some point, I wanted newer LLVM features for better documentation generation. I tried building LLVM with LTO without really understanding what I was doing and got nowhere. It linked against libstdc++ unexpectedly, and I ended up exporting custom library paths in my shell every time I opened a terminal just to make it work. My LLVM build had dynamic dependencies pointing to random directories, and I was constantly patching my environment to keep it running.

Eventually, I had a barely functional compiler. I then tried to get MSVC cross-compilation working from Linux without understanding sysroots. After more experimentation, I began exporting Docker images for other Linux distributions and finally achieved my first basic, proper cross-compilation setup. At that stage, I only used system dependencies and CMake subdirectories.

Later, I wanted to use C++20 features like import std. GCC didn’t support it yet, and distribution packages were outdated, so I learned how to build libc++. At first, I barely understood linking. I manually deleted shared libraries, adjusted linker paths blindly, and made many questionable decisions. After several iterations, I gradually started to understand what I was doing.

My real breakthrough came when I tried compiling GTK from source. The typical CMake approach didn’t work because GTK relies on multiple build systems, and I refused to use my distribution’s package manager.

I eventually managed to build it, then decided to drop libgcc entirely. That decision led me to build compiler-rt and eventually down the path of compiling Rust, since GTK had Rust dependencies that were linking against libgcc. After many more iterations, my toolchain became more organized. I improved how I linked my own libc++, structured my toolchain directories properly, and cleaned things up.

I also experimented with Sphinx for documentation, various testing frameworks, and fuzzers. Then I added musl to my repertoire. I failed many times before understanding the basics. I tried compiling SDL with musl, failed again, and got stuck for a while. After that, I experimented with SYCL, which was another unusual experience.

Eventually, I grew tired of manually building everything into a custom buildroot and adopted Conan after briefly trying vcpkg. I initially used Conan’s toolchain abstractions and generators, but dropped them when they caused strange issues. I moved to full deploy mode and later to a custom deployment script.

At that point, I had package management under control. I started creating my own .pc and .cmake packages for regular libraries, and distributing .pcm files for C++ modules.

The chronology might not be perfect, but this is roughly what happened.

--------

What feels strange is the dual nature of this journey. On one hand, exploring how everything works under the hood is fascinating and gives enormous flexibility. On the other hand, I spent a huge amount of time on it and burned out multiple times. I now understand how these systems work and how to set them up correctly, but I also abandoned many “dumb” projects I originally wanted to build. I just couldn’t stop going deeper into the infrastructure.

Recently, I added import std and C++20 module support to Meson and switched my ray tracer to it.

At this point, I feel like I’ve explored almost everything in this space — except maybe manually building a FreeRTOS image and flashing it to a microcontroller. Now I want to redirect my energy toward domain-related work.

Still, I feel strange about the whole experience. I never would have imaged I would spend so much on this. I feel very burnt out to able to actually work on something sometimes.


r/cpp • • Feb 15 '26

CppCon CppCon 2026 - Cost & Preparations

17 Upvotes

Hi Everyone, 

I'm planning to attend CppCon 2026 for the first time.
I'll be flying from the other half of the world for this, which isn't cheap by any means (tickets are around$1700).
I've been saving up money for some time now, but I was wondering, can somebody help me with how much the tickets and accommodations cost in general so I can be prepared ?
I understand that tickets sell cheaper usually for students. If so, how much cheaper? (I'm a student if that makes a difference.)

Thanks in advance guys!


r/cpp • • Feb 14 '26

Profiling on Windows: a Short Rant · Mathieu Ropert

Thumbnail mropert.github.io
57 Upvotes

r/cpp • • Feb 13 '26

Your Optimized Code Can Be Debugged - Here's How With MSVC C++ Dynamic Debugging - Eric Brumer

Thumbnail youtu.be
95 Upvotes

Just watched this video, really cool stuff. I don’t have any background in compiler development, how hard will it be for other compilers (and build systems?) to adopt something like this?


r/cpp • • Feb 13 '26

Another writeup of how to implement C++ coroutines

27 Upvotes

https://rhidian-server.com/implementing-c-coroutines/

Hope you enjoy, feel free to provide critiques and/or feedback :) I want to tackle coroutine memory safety next, as it's something that's really essential to coroutines and using them throughout your codebase


r/cpp • • Feb 14 '26

Automatic casting with applications to extension methods and UFCS (language evolution)

0 Upvotes

INTRODUCTION

I'm a fan of UFCS, I probably think too much about it. Maybe here's a different direction towards UFCS. The idea is that a simple language addition could (through some development) lead to Extension Methods and UFCS.

This language addition might be called automatic casting.

CHAPTER 1: AUTO-CAST

Say that I want to call the std::string member function find_first_of on a const char* string, "Hello3".

Of course, I can't call

"Hello3".find_first_of("123")  

but it's easy if I first convert the C string into a std::string:

string("Hello3").find_first_of("123")

Maybe we could invent some syntax to tell the compiler to auto-cast a const char* to a string, where needed:

// auto-cast const char* to string. 
auto operator string(const char* s){return string(s);}

We have entered the realm of MMINAE (missing member is not an error). If the compiler can't resolve a member function, it will then apply the user-defined auto-casts (in order) until the casted value can resolve the member function, which is then used.

More complicated auto-casts can be defined. For example, this will auto-cast an int to a string, by converting the digits to ASCII:

auto operator string(int n){return to_string(n);}

Then this allows code like:

(654321).find_first_of("123")

which will, after some MMINAE scanning, convert this code to:

to_string(654321).find_first_of("123")

CHAPTER 2: EXTENSION METHODS

I'd like to extend std::string by adding another member function, hasInt(int n). Not by actually going into the <string> header file and adding a member function, but by creating some code to give that illusion.

First, I define a helper class that provides the hasInt member function:

struct StringHasInt : public string {
    bool hasInt(int n){
        return this->contains(to_string(n));
    }
};

Then define an auto-cast from a string to a StringHasInt:

auto operator StringHasInt(string s){return static_cast<StringHasInt>(s);}

Thus, when I call hasInt on a string:

string text;
... 
text.hasInt(123);

MMINAE scanning will activate, and resolve the missing member by converting to the code:

static_cast<StringHasInt>(text).hasInt(123);

CHAPTER 3: UFCS

So, if we want to "do the UFCS" and would like to get from:

bool hasInt(const string s, int n){...etc...

to

text.hasInt(123)

by a simple macro call:

MAKE_UFCS(hasInt);

How is this done? The macro magic to convert this to a helper class followed by an auto-cast is left as an exercise to the reader!


r/cpp • • Feb 13 '26

CppCon Back to Basics: (Range) Algorithms in C++ - Klaus Iglberger - CppCon 2023

Thumbnail youtube.com
21 Upvotes

r/cpp • • Feb 13 '26

HPX Tutorials: Futures & Async

Thumbnail youtube.com
10 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 asynchronous programming to write efficient, non-blocking C++ code. We focus on the implementation of futures as placeholders for asynchronous results, demonstrating how to launch lightweight tasks using hpx::async and synchronize them effectively. The tutorial details the use of hpx::when_all and continuations to manage task dependencies, ensuring that parallel operations complete reliably before processing results. This provides a clear introduction to scaling computations, culminating in a practical implementation of Conway's Game of Life, where we illustrate how to update grid cells asynchronously to achieve seamless parallel 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 • • Feb 12 '26

The story of making RocksDB ingestion 23x times faster

Thumbnail blog.serenedb.com
43 Upvotes

r/cpp • • Feb 12 '26

New version of SwedenCpp website released, with more C++ info than ever

Thumbnail swedencpp.se
22 Upvotes

I just released the new version of the SwedenCpp.se homepage, now more of a C++ information hub than a local user group website.

Showing hourly fresh content about:

  • Upcoming C++ Meetups
  • Videos (conference/creator/usergroups)
  • Blogs
  • Releases (> 100 interesting github release monitored)
  • Podcasts (we do not have many C++ podcasts :-( )

There are, for sure, some child diseases on the page, and since I moved the provider, SSL issues may be the case.
However, since it's online now, I thought I would share the update news now.


r/cpp • • Sep 16 '25

VImpl: A Virtual Take on the C++ PImpl Pattern

Thumbnail solidean.com
37 Upvotes

It's probably not super original but maybe some people will appreciate the ergonomics! So basically, classic pimpl is a lot of ceremony to decouple your header from member dependencies. VImpl (virtual impl) is solving the same issue with very similar performance penalties but has almost no boilerplate compared to the original C++ header/source separation. I think that's pretty neat so if it helps some people, that'd be great!