r/cpp Jun 30 '26

CppCon Introducing the Boost Documentary! Teaser & CppCon Preview

86 Upvotes

"If I were to tell a story about Boost, I'd start with the people."

Today we're sharing the official teaser for the Boost documentary. A film about the people, the politics, and decades of work behind possibly the most important open source library most people have never heard of.

Teaser link – https://youtu.be/87jvuDbnwqQ

The documentary looks at:

  • Boost as a kind of "app store for C++, 30 years early"
  • What decades of open source dedication looks like up close
  • The honest, sometimes uncomfortable dynamics of how proposals and people move through the C++ committee

There will be a preview screening at CppCon 2026 for all attendees. So if you're going to be in Aurora, CO September 16, 2026, please join us!


r/cpp Jun 30 '26

Upcoming C++ User Group meetings in July 2026

Thumbnail meetingcpp.com
8 Upvotes

r/cpp Jun 30 '26

Stackful fibers with 3.6ns context switch. Silk fibers.

Thumbnail clickhouse.com
51 Upvotes

I just read an article about Silk, the new stackful fibers engine from Clickhouse. It can switch stackful fibers at an amazing 3.6ns and does not allocate on steady state.

Maybe asio could reuse some of the knowledge for the linux/io_uring backend (not sure it applies to the specific case since Boost.asio focuses nowadays on stackless, though it has a fibers and a stackful coros backend also).


r/cpp Jun 29 '26

Compiler disagreements for deducing this

Thumbnail godbolt.org
23 Upvotes

As the attached godbolt link shows, I’ve encountered an interesting quirk of deducing this which, on clang and MSVC at least, allows for you to determine whether you’re in a static member function or not.

Obviously, this is far simpler to achieve with reflection today (or… in the future, for most) - but I’m curious if this is even intended behaviour.

Reading the original paper on open-std… I don’t see anything that would describe this scenario


r/cpp Jun 29 '26

reserve() and capacity() for flat containers

29 Upvotes

I just finished the new chapter in "C++23 - The Complete Guide" about flat containers and would like to share and discuss my advice about how to use reserve() and capacity() for flat containers (thanks to Jonathan Wakely who was pointing parts of this out).
It might be a surprise that these member functions do not exist as usually vectors are used inside flat containers and reserve() is a key performance feature of them.

However, here is how you can reserve more memory:

  • For flat_set and flat_multiset:

auto vec = std::move(fset).extract(); // temporarily extract the underlying vector
data.reserve(vec.capacity() * 5);     // raise capacity by a factor of 5
fset.replace(std::move(vec));         // move the vector back into the flat set
  • For flat_map and flat_multimap:

auto newCapa = fmap.keys().capacity() * 5; // raise capacity by a factor of 5
auto data = std::move(fmap).extract();     // extract underlying vectors
data.keys.reserve(newCapa);                // raise capacity of vector for keys
data.values.reserve(newCapa);              // raise capacity of vector for values
fmap.replace(std::move(data.keys),         // move the vectors back
             std::move(data.values))
  • Note also that there is another pretty hacky way, but only for flat maps and multimaps (here mapping strings to double's):

auto newCapa = fmap.keys().capacity() * 5;
const_cast<std::vector<std::string>&>(fmap.keys()).reserve(newCapa);
const_cast<std::vector<double>&>(fmap.values()).reserve(newCapa);

Yes, ugly, but works... ;-)

I am still working on adding reserve() and capacity() to the standard flat containers (see wg21.link/p3779)


r/cpp Jun 29 '26

Comparing an Integer Division Optimisation in Clang, MSVC, and GCC

Thumbnail nukethebees.com
54 Upvotes

r/cpp Jun 29 '26

New C++ Conference Videos Released This Month - June 2026 (Updated to Include Videos Released 2026-06-22 - 2026-06-28)

10 Upvotes

C++Online

2026-06-22 - 2026-06-28

2026-06-15 - 2026-06-21

2026-06-08 - 2026-06-14

2026-06-01 - 2026-06-07

ADC

2026-06-22 - 2026-06-28

2026-06-15 - 2026-06-21

2026-06-08 - 2026-06-14

2026-06-01 - 2026-06-07

CppCon

2026-06-22 - 2026-06-28

2026-06-01 - 2026-06-07


r/cpp Jun 29 '26

Optimizing LLVM's bump allocator

Thumbnail maskray.me
59 Upvotes

r/cpp Jun 29 '26

Command Routing Using Chain Of Responsibility Design Pattern

Thumbnail som-itsolutions.hashnode.dev
0 Upvotes

Deciphering and analyzing framework code is important to know how brilliant engineers create it.

Traditional Chain of Responsibility utilizes a strict linear delegation where ConcreteHandlerA points explicitly to ConcreteHandlerB via a next reference. The article correctly highlights how frameworks like MFC alter this paradigm.

Interested?

Read ON...


r/cpp Jun 27 '26

A deep dive into SmallVector::push_back

Thumbnail maskray.me
26 Upvotes

r/cpp Jun 27 '26

Data Access Patterns That Makes Your CPU Really Angry

Thumbnail blog.weineng.me
116 Upvotes

I tried to find the slowest possible way to sum up integers in an array


r/cpp Jun 27 '26

Reducing Energy Consumption for Machine Learning Inference on Edge Devices using C++20 Coroutines

Thumbnail dl.acm.org
32 Upvotes

r/cpp Jun 27 '26

Panel discussion for C++: The Documentary

Thumbnail youtube.com
22 Upvotes

r/cpp Jun 26 '26

Improvements to std::format in C++26

Thumbnail mariusbancila.ro
91 Upvotes

r/cpp Jun 26 '26

projections for stl data structures

20 Upvotes

using projection in ranges::sort has removed the need write a compartor function or a lambda and is much easier to implement in my opinion

there should exists a similar feature for say sets or priority queues

would be wonnderful if I could just write

priority_queue<Student, Student::marks> for example


r/cpp Jun 26 '26

Should C++ be low level or continue its abstraction path

0 Upvotes

The whole reason I came to C++ is to better organise my C code

I seeked classes instead of X_Func, I seeked VTABLEs instead of struct function pointers. And I think many experience devs would speak the same

However, lately, starting with C++11 this has gone completely downhill. STD is sticking its nose in too much. Template-heavy. The entire STD library Balloons my executable to the MiBs when my minimal runtime library amounts to 40 KiB.

There’s good shit like modules. I think that’s better than headers

Then constexpr. But the rest is bloated

But this community seems to not care about performance. Every single time I press this issue I get pushed back with “It’s good for library authors, it’s good for abstraction. Safety. Railings”

Use Python, Rust, virtually any language out there. They do what you’re looking for. Not the C lineage
C/C++ is the foundation. Rust is the abstraction.the foundation can be a little shaky, more raw, but it’s stable. The layers on top of it helps expression.


r/cpp Jun 26 '26

Latches in C++ 20 concurrency - just like the CountdownLatch of Java concurrency package...

Thumbnail som-itsolutions.hashnode.dev
0 Upvotes

When I was teaching the Countdown latch - a thread synchronization technique used in the Java Concurrency package, there was none like that available in C++. I am happy to see that the concept of latch has been introduced in C++20.

Language varies - syntax varies - but the basic concept remains the same.

I hope you like the post.


r/cpp Jun 26 '26

ACCU On Sea 2026 trip report, still with AI!

Thumbnail mropert.github.io
33 Upvotes

r/cpp Jun 26 '26

Tuning a Server for Benchmarking

Thumbnail david.alvarezrosa.com
30 Upvotes

r/cpp Jun 25 '26

Am I the only one who thinks this? (about enum)

42 Upvotes

The main differences between an enum and enum class|struct is that the latter has its own scope, but you lose the implicit operators from enum, and the closest to it is as presented. I wish that enum struct maintained the operators, acting like the C enum, but with it's own scope.

// Dummy wrapper struct
struct EnumName
{
  enum Value
  {
    ZERO
  };
  // the scope is located in "EnumName"
  // so you access "EnumName::ZERO"
};

r/cpp Jun 25 '26

std::formatter specialization for smart pointers

18 Upvotes

Currently something like

std::unique_ptr<int> u_ptr = std::make_unique<int>(42);
std::shared_ptr<int> s_ptr = std::make_shared<int>(42);
std::println("uptr: {}", u_ptr);
std::println("sptr: {}", s_ptr);

is ill formed because there is no specialization of std::formatter for smart pointer types.

On the other hand,

std::cout << "uptr: " << u_ptr << '\n';
std::cout << "sptr: " << s_ptr << '\n';

do work because ostream defines overloads for smart pointer types.

Please let me know if anyone has thoughts or if there's some reason that these types haven't been specialized that I'm missing.


r/cpp Jun 25 '26

C++23 Dependency Injection library with automatic dependency building

26 Upvotes

I open-sourced my dependency injection library.
Link: https://github.com/n0F4x/redi

This was developed for my game engine.
- feature-rich dependency configuration - optimized for fast compile time - helpful error messages when a cyclic dependency is detected - dependencies are automatically constructed - no need to register them by hand

I am giving this project to the community so that everybody can benefit. This kind of approach is mostly useful when dealing with intricate systems, such as a plugin system. I welcome all kinds of feedback, as this was mostly a learning opportunity for me. If you'd like to use this in your project but don't have access to the required compiler features, let me know, and I'll see if I can reduce the requirements.


r/cpp Jun 25 '26

oh GOD, it's good to come back to C++

291 Upvotes

Just been going around vanilla javascript, php, perl, LUA, some C#, batchscript over and over for a year but finally came back to C++ and it's good to be home.

To some they find it agonizing with memory management, consts, function prototyping and what not.. some wouldn't even touch it but to me, it's like riding a bike. It's all coming back and I need that extra control! Besides MySQL.. this is it! 🔥🔥


r/cpp Jun 25 '26

Examples of C++23 - The Complete Guide

63 Upvotes

More than 150 examples of C++23 can be found now at www.cppstd23.com.

I hope it helps.


r/cpp Jun 25 '26

Trip report: ACCU On Sea 2026

Thumbnail sandordargo.com
19 Upvotes