C++ - Reddit
228 subscribers
48 photos
8 videos
25.3K links
Stay up-to-date with everything C++!
Content directly fetched from the subreddit just for you.

Join our group for discussions : @programminginc

Powered by : @r_channels
Download Telegram
reserve() and capacity() for flat containers

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;
constcast<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)



https://redd.it/1uj3tau
@r_cpp
FIX implementation

I want to implement low latency high throughput FIX server and client, where should I start? Any guides?

https://redd.it/1uj93w1
@r_cpp
Introducing the Boost Documentary! Teaser & CppCon Preview

"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](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!





https://redd.it/1ujqpdy
@r_cpp
Latest News From Upcoming C++ Conferences (2026-06-30)

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

CppCon (12th – 18th September) – You can buy standard tickets until August 29th at [https://cppcon.org/registration/](https://cppcon.org/registration/)
C++ Under The Sea (14th – 16th October) – You can buy early bird tickets at https://sales.ticketing.cm.com/cppunderthesea2026/
(NEW) ADC – (9th – 11th November) – Tickets for ADC can now be purchased at [https://ti.to/audio-developer-conference/adc-bristol-2026](https://ti.to/audio-developer-conference/adc-bristol-2026)
Meeting C++ (26th – 28th November) – You can buy early bird tickets at https://meetingcpp.com/2026/

OPEN CALL FOR SPEAKERS

OTHER OPEN CALLS

(NEW) CppCon Call For Volunteers Now Open – Interested volunteers have until August 1st to apply at the CppCon main conference which is scheduled to take place from 14th – 18th September. For more information including how to apply visit [https://cppcon.org/cfv2026/](https://cppcon.org/cfv2026/)
(Last Chance) CppCon Call For Posters Now Open – Interested poster presenters have until July 15th to submit their applications for the CppCon main conference which is scheduled to take place from 14th – 18th September. For more information including how to apply visit https://cppcon.org/cppcon-2026-call-for-poster-submissions/
CppCon Call For Authors Now Open! – CppCon are looking for book authors who want to engage with potential reviewers and readers. Read the full announcement at [https://cppcon.org/call-for-author-2026/](https://cppcon.org/call-for-author-2026/) 

TRAINING COURSES AVAILABLE FOR PURCHASE

Conferences are offering the following training courses:

C++Online

1. AI++ 101 – Build an AI Coding Assistant in C++ – Jody Hagins – 1 day online workshop available on
Friday 24th July 16:00 – 00:00 UTC/0900-1700 PDT – [https://cpponline.uk/workshop/ai-101/](https://cpponline.uk/workshop/ai-101/)
Watch the preview session here https://youtu.be/suP5zA7QqW4

CppCon Online Workshops

9th – 11th September

1. Modern C++: When Efficiency Matters – Andreas Fertig – 3 day online workshop available on 9th – 11th September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-when-efficiency-matters/
2. System Architecture And Design Using Modern C++ – Charley Bay – 3 day online workshop available on 9th – 11th September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-system-architecture-and-design-using-modern-cpp/

21st – 23rd September

1. C++ Fundamentals You Wish You Had Known Earlier – Mateusz Pusz – 3 day online workshop available on 21st– 23rd September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-cpp-fundamentals/
2. C++23 in Practice: A Complete Introduction – Nicolai Josuttis – 3 day online workshop available on 21st– 23rd September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-cpp23-in-practice/
3. Programming with C++20 – Andreas Fertig – 3 day online workshop available on 21st– 23rd September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-programming-with-cpp20/

26th – 27th September

1. Using C++ for Low-Latency Systems – Patrice Roy – 2 day online workshop available on 26th– 27th September 09.00 – 17.00 MDT –
https://cppcon.org/class-2026-low-latency/

CppCon Onsite Workshops

All onsite workshops will take place in the Gaylord Rockies in Aurora, Colorado

12th & 13th September

1. Advanced and Modern C++ Programming: The Tricky Parts – Nicolai Josuttis – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-tricky-parts/
2. C++ Best Practices – Jason Turner – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-best-practices/
3. How Hardware Gets Hacked: Breaking and Defending Embedded Systems – Nathan Jones – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-hardware-hack/
4. Mastering `std::execution`: A Hands-On Workshop – Mateusz Pusz – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-execution/
5. Performance and Efficiency in C++ for Experts, Future Experts, and Everyone Else – Fedor Pikus – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-performance-and-efficiency/
6. Talking Tech – Sherry Sontag – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-talking-tech/

 13th September

1. AI++ 101 : Build a C++ Coding Agent from Scratch – Jody Hagins – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-AI101/
2. Essential GDB and Linux System Tools – Mike Shah – 1 day in-person workshop available on 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-essential-gdb/

19th & 20th September

1. AI++ 201: Building High Quality C++ Infrastructure with AI – Jody Hagins – 2 day in-person workshop available on 19th & 20th September – 09:00 – 17:00 – https://cppcon.org/class-2026-ai201/
2. Function and Class Design with C++2x – Jeff Garland – 2 day in-person workshop available on 19th & 20th September – 09:00 – 17:00 – https://cppcon.org/class-2026-function-class-design/
3. High-performance Concurrency in C++ – Fedor Pikus – 2 day in-person workshop available on 19th & 20th September – 09:00 – 17:00 – https://cppcon.org/class-2026-high-perf-concurrency/

OTHER NEWS

(NEW) Accepted Sessions For Meeting C++ Announced – Visit [https://meetingcpp.com/mcpp/schedule/talklisting.php](https://meetingcpp.com/mcpp/schedule/talklisting.php) to see the list of accepted talks
(NEW) Last Chance To Apply For CppCon 2026 Attendance Support Ticket Program! – Includes free tickets for people who would not be able to attend otherwise. Find out more including how to apply at https://cppcon.org/cppcon-2026-attendance-support-ticket-program/

https://redd.it/1ujukl2
@r_cpp
Nuevo framework en c++ vixcpp

Hace un tiempo sigo a gari el creador de vixcpp en framework bastante interesante vengo practicando cosas en drogon y obviamente lo mas difícil no es c++ en si, sino lograr ingresar todo hasta despliegue, algo que vixpp a mitigate mucho con su vix run al estilo cargo de run. Me gustaría escuchar las opiniones de los expertos y los que no lo conozcan hechenle un ojito

https://redd.it/1ujt95y
@r_cpp
Vix.cpp vs. Drogon/Crow: Is a "Node.js-like" workflow the future for modern C++ backend development? Looking for expert feedback!

Hi everyone,

I’ve been deeply exploring modern C++ (C++20/23) for backend architecture, looking at how we can make high-performance systems more accessible to developers coming from ecosystems like Node.js, Go, or Rust without losing raw native performance or explicit control.

We all know the established giants: Drogon is incredibly fast and feature-rich (but relies heavily on its own CMake setups, complex configuration files, and drogon_ctl), and Crow is fantastic for small, microservice-like Express-style APIs, but can feel limited when scaling full production runtimes.

Recently, I’ve been looking into Vix.cpp, and I feel it approaches the problem from a completely different angle that benefits both beginners and modern backend design. I’d love to get the community's expert thoughts on its architecture and ergonomics.

Why Vix.cpp caught my attention (especially compared to Drogon/Crow):

It’s a Runtime, not just an HTTP Library: While Crow and Drogon focus heavily on routing and HTTP, Vix.cpp acts more like a native application runtime (akin to a native alternative to Node/Bun, but without a GC or engine overhead). It bundles out-of-the-box non-blocking asynchronous modules (async, fs, crypto, db, p2p_http, webrpc) designed to work together coherently.

The Developer Workflow (UX/DX): For beginners or developers migrating to C++, managing CMakeLists.txt pipelines, linking dependencies, and configuring build environments is usually a massive friction point. Vix provides a unified CLI toolchain:

Bash

vix new api vix install vix run main.cpp vix build vix tests

It doesn't replace CMake underneath (you can keep your custom setups), but it abstracts the lifecycle smoothly.

Ergonomic Middleware and State Management: Unlike older frameworks where middleware composition can accidentally introduce blocking calls or obscure types, Vix utilizes a modern context-based layout (MiddlewareFn) with safe, explicit type-based request storage (similar to std::any via state injections).

The Trade-offs & Questions for the Experts:

As much as I like the ergonomics and the data-oriented feel of Vix, I want to spark an honest discussion:

Performance at Scale: Drogon is consistently at the top of TechEmpower benchmarks. Vix uses a modern Asio-based async core and boasts great local release metrics, but how does its runtime abstraction handle raw throughput under extreme hardware utilization compared to Drogon’s thread-pool model?

Ecosystem Isolation: Does building an integrated module ecosystem (vix::db, vix::net, vix::json) run the risk of alienating developers who prefer to manually stitch together standalone libraries (like nlohmann/json or fmt) via vcpkg/Conan?

Is this the right path for beginners? Do you think providing an "all-in-one" workflow layer lowers the barrier to entry for C++ backend engineering, or does it abstract too much of the underlying native toolchain mechanics?

I’d highly appreciate it if the veterans here could take a look at the architecture, tell me where this approach might fall short, or share your experiences if you've integrated Vix into your production stack.

https://redd.it/1ujzlmn
@r_cpp
What's the fastest c++ build pipeline you've achieved ?

Trying to get a realistic picture of what's actually achievable on a large c++ codename before we commit to anything. We're at 450k LOC, full clean builds sitting around at 55 minites on a 16-core machine. Incremental builds are manageable but a full rebuild after a branch switch or a CI run is painful. We've moved to Ninja, cache is in place, worst of the header bloat is cleaned up. At this point it feels like We're pushing against a hardware ceiling rather than a tooling one. Distributed compilation seems like the logical next move , but I'm also wondering if there's something between local optimizations and a full distrubuted setup that actually moves the needle. Anyone hit similar numbers at this scale and seen meaningful improvements?

https://redd.it/1uklb9y
@r_cpp
Can windows devs provide us with a visual studio sdk in a tarball/zip form?

Currently, in order to cross compile to windows properly we either download visual studio in a windows machine, copy it's contents to our machine and pass /winsysroot to clang-cl or it's equilevent gnu flag.

Or we use msvc wine to download using wine and deal with capitalization issues.

Why can't windows devs provide us with something similar to msvc wine? It would really simplify getting sysroots to setting up your toolchain.

I filed a ticked to but didn't heard a reply. If anyone here can raise awareness on this issue it would help the whole community.

https://redd.it/1ukm4g0
@r_cpp
Rate my code!

#include <stdio.h> #include <string.h> #include <iostream> #include <filesystem> using namespace std; namespace fs = std::filesystem; using S = string; using H = const unsigned char; using F = void()(); using G = S()(); using D = void()(fs::path); using Q = void()(S); template<int N, int K> struct Z { S d(H h) { S r; int key = K; for(int i = 0; i < N; i++) { r += char(h[i] ^ key); key = (key 0x5F + 0x13) & 0xFF; } for(char &c : r) c = (c ^ 0x7F) - 3; return r; } }; S b(H h, int n) { S s; for(int i=0;i<n;i++) s+=char(hi); return s; } struct Obf { void o(S x) { cout << x; } S i() { S t; cin >> t; return t; } }; bool d(S p) { return fs::isdirectory(p); } void l(fs::path p) { for(auto& e : fs::directoryiterator(p)) cout << e.path().filename().string() << '\n'; } Obf ob; void e() { ob.o(b((H)"\x73\x6f\x72\x72\x79\x20\x77\x65\x20\x63\x6f\x75\x6c\x64\x20\x6e\x6f\x74\x20\x66\x69\x6e\x64\x20\x79\x6f\x75\x72\x20\x64\x69\x72\x65\x63\x74\x6f\x72\x79\x0a",38)); } void r(S p) { d(p) ? l(p) : e(); } S g() { return ob.i(); } F vf32; G gf8; D df8; Q qf8; void s1() { ob.o(Z<76, 0x37>().d((H)"\x4f\x5a\x58\x4e\x4b\x4e\x20\x60\x65\x5e\x52\x52\x20\x5d\x5e\x20\x5e\x5e\x63\x5e\x20\x57\x5d\x5e\x55\x5e\x5e\x5f\x5e\x20\x5e\x5f\x20\x5e\x5e\x5f\x20\x27\x2e\x2e\x27\x20\x5a\x5e\x5f\x20\x60\x5d\x5d\x5e\x27\x60\x20\x5f\x63\x5f\x5f\x5e\x5e\x5f\x20\x57\x5d\x5e\x55\x5e\x5e\x5f\x0a")); S x = gf0; x == "CD" ? vf9 : qf0; } void s2() { vf10; } void s3() { df0); } void s4(S p) { qf1; } void s5() { ob.o(b((H)"\x0a",1)); } int main() { vf0 = s1; vf9 = s3; vf10 = s2; df0 = l; qf0 = r; qf[1] = s4; gf[0] = g; vf0; s5(); return 0; }

https://redd.it/1ukn1v3
@r_cpp
Learning about Asymmetric Fences and its Underlying Mechanism - Membarrier

https://nekrozqliphort.github.io/posts/membarrier/

Hey, everyone! You might remember my previous write-ups on \[\[no\_unique\_address\\]](https://www.reddit.com/r/cpp/s/YwbtMBDgz9) and strongly happens before. It took a few months of researching but I finally have a draft version of my new write-up on asymmetric fences (hopefully building up to a write-up on RCU).

This write-up essentially goes into what asymmetric fences are supposed to achieve, its underlying mechanism (the membarrier syscall), and the wording in the standard. Special thanks to u/davidtgoldblatt for his insights and discussions regarding this topic!

Feel free to provide any feedback! This one is denser than my usual write-ups, but I hope you'll find it interesting and insightful.

https://redd.it/1ukskdo
@r_cpp