-
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
Opinion on this video?
https://youtube.com/watch?v=wQQP_si_VR8&si=XH8nkbikyv8XUX5m
https://redd.it/1nsn66r
@r_cpp
Spore Proxy — Template-Friendly Runtime Polymorphism for C++20
https://github.com/sporacid/spore-proxy
https://redd.it/1nscxzh
@r_cpp
expected polyfill for C++20 compilers
Inspired by the question about support for std::expected in an old Clang version (and also for my own needs, obviously) I wrote a polyfill for expected for projects which have to stay at C++20 rather than move to C++23. It's available here, and the unit tests for it are here
Available under ISC license, and supported for gcc 12 (and later), clang 16 (and later), recent apple-clang and recent MSVC.
Enjoy !
https://redd.it/1ns4mjj
@r_cpp
proto alternative idea: plain struct + zero copy + shm lpc
so i been annoyed with protobuf/flatbuffers. they work, but too heavy.
what i want instead:
• idl that looks like proto (maybe even accept proto3 subset directly)
• generates plain struct in c++
• no getters/setters, just view.count = 42;
• read = zero-copy (span, stringview)
• write = builder with vector/string then flatten to array
• nested struct works like view.meta.enabled
• endian/padding safe
extra idea:
• rpc not via gRPC. too fat.
• instead default transport = shared memory / local procedure call style
• literally just: write request struct to shm, signal, other side writes response struct
• no copy, super fast.
• later can plug tcp/ws if someone really wants network.
i also have a tiny container lib SmartSeq, thinking to use it here:
• builder side = SmartSeq (like vector/string but cheaper, inline small storage)
• view side = SmartSeqView (span/stringview style, zero copy)
usage would look like:
std::array<uint8t, 8> buf{};
ExampleView view(buf);
view->count = 42;
view->meta.enabled = true;
std::cout << view->count << " " << view->meta.enabled << "\n";
why bother?
- zero-copy read (span/stringview, no memcpy)
- plain struct usage (view.count = 42;) instead of getters/setters
- endian/padding portable across compilers
- can reuse existing .proto files (subset) → no new IDL learning
- rpc over shared memory (super fast local ipc, no gRPC overhead)
- tiny runtime, just generated structs, good for embedded/IoT
so question:
• would cpp ppl actually care about this?
• is “proto-lite + shm rpc” cool or just me reinventing wheels?
• anyone interested maybe to collab / give feedback?
https://redd.it/1nrsynq
@r_cpp
What will be the introduction of static reflection (ct) that seems to arrive with c++26?
https://redd.it/1nroy48
@r_cpp
CppCon 2025 Trip Report – tipi.build by EngFlow
https://tipi.build/blog/20250925-CppCon2025
https://redd.it/1nrajcz
@r_cpp
Issue with for loop and ranges
I got stuck with a weird issue using for and ranges. The summary is, with c++20 on my macos (appleClang17) this doesn't workfor (auto [x,y]: functionThatReturnsView() )
vs this actually works
auto container = functionThatReturnsView();
for (auto [x,y]: container)
std::flip
https://morwenn.github.io//c++/2025/09/25/TSB004-std-flip.html
https://redd.it/1nqt3nr
@r_cpp
Weird memory management
I came across an old legacy code managing memory at works and here I am, at 5am in the morning, trying to understand why it doesn’t completely work. Maybe some of you could have ideas…
I have an ObjectPool<T> which is responsible for allocating predefined amount of memory at program startup, and reuse this memory across program lifetime.
To do that, they wrote an RAII wrapper called « AcquiredObject<T> », which is responsible of constructors/destructors, ->, * operators, …
And then all Types used with this ObjectPool are simple objects, often derived from multiple domain-specific objects.
BUT: after computer (not program!) being up for 3 to 4 days without interruption, a « memory leak » occurs (inside ObjectPool).
This code was previously compiled with g++4, I had to go with g++11 to resolve COTS compatibility issues. I correctly implemented move constructor and move assignment operator in AcquiredObject, thinking this bug would be tied to C++ 11 being differently compiled with those 2 different compilers versions.
I have run some « endurance » tests, with 15h without problems. And sometimes, 4 days later (computer up, not program), leak arrives within 5 first minutes.
Have you ever seen such cases ?
https://redd.it/1nqqkb5
@r_cpp
PSA: if you use visual studio with visual assist for C++, There was a windows update to edge (or something) that somehow breaks alt+shift+s (symbol search) by a background edge process.
Hey, just wanted to drop this somewhere on the internet to hopefully help others.
On my windows machine, I use visual studio + visual assist for large C++ projects.
A core feature, symbol search, has just arbitrarily stopped working like normal, disrupting my flow.
The feature still works, but not the keybind (alt+shift+s). This was also affecting my VSCode keybinds.
The keybind would be fine for a while, then randomly stop.
I got desperate and just started task-killing processes from the task manager
Eventually I got to msedge.exe and after stopping those processes, the issue disappeared.
I didn't even have Microsoft edge open, it seems to have opened itself in the background for some reason. (maybe updating?)
I figure there might be someone else getting affected by this, so hopefully this will get indexed to help them.
As I wasted way too much time figuring this one out.
https://redd.it/1nqmogi
@r_cpp
Highlighting the student and support tickets for Meeting C++ 2025
https://meetingcpp.com/meetingcpp/news/items/Highlighting-the-student-and-support-tickets-for-Meeting-Cpp-2025.html
https://redd.it/1nq8ex0
@r_cpp
Can someone tell me HOW file paths work in C++? (VS 2019)
Hello,
Something I haven't been able to understand about C++ is how file paths work. Whenever I try to use them, they either don't detect them or don't do anything. So, can someone explain to me what I can do? I can't keep avoiding them.
https://redd.it/1npss9c
@r_cpp
Pulling contract?
My ISO kungfu is trash so..
After seeing bunch of nb comments are “its no good pull it out”, while it was voted in. Is Kona gonna poll on “pull it out even though we already put it in” ? is it 1 NB / 1 vote ?
Kinda lost on how that works…
https://redd.it/1npofsn
@r_cpp
like method calls do in C++ is so complicated that it's almost impossible to truly make the library opaque for us, the users, and thus the learning curve as well as the error messages seem to be... well, scary :)
The first difference is that \`some\` is single-header library and has no external dependencies, which means you can drag-and-drop it into any project without all the bells and whistles. (It has an MIT license, so the licensing part should be easy as well)
The main difference however is that it is trying to leverage as much as possible from an already existing compiler machinery, so the compiler will generate the vtable for us and we will just happily use it. It is indeed a bit more tricky than that, since we also support SBO (small buffer optimisation) so that small objects don't need allocation. How small exactly? Well, the SBO in \`some\` (and \`fsome\`, more on that later) is configurable (with an NTTP parameter), so you are the one in charge. And on sufficiently new compilers it even looks nice: some<Trait> for a default, some<Trait, {.sbo{32}, .copy=false}> for a different configuration. And hey, remember the "value semantics" bit? Well, it's also supported. As are the polymorphic views and even a bit more, but first let's recap:
the real benefit of rolling out your own vtable is obvious - it's about control. The possibilities are endless! You can inline it into the object, or... not. Oh well, you can also store the vptr not in the object that lives on the heap but directly into the polymorphic handle. So all in all, it would seem that we have a few (relatively) sensible options:
1. inline the vtable into the object (may be on the heap)
2. inline the vtable into the polymorphic object handle
3. store the vtable somewhere else and store the vptr to it in the object
4. store the vtable somewhere else and store the vptr in the handle alongside a pointer to the object.
It appears that for everything but the smallest of interfaces the second option is probably a step too far, since it will make our handle absolutely huge. Then if, say, you want to be iterating through some vector of these polymorphic things, whatever performance you'll likely get due to less jumps will diminish due to the size of the individual handle objects that will fit in the caches the worse the bigger they get.
The first option is nice but we're not getting it, sorry guys, we just ain't.
However, number 3 and 4 are quite achievable.
Now, as you might have guessed, number 3 is \`some\`. The mechanism is pretty much what usual OO-style C++ runtime polymorphism mechanism, which comes as no surprise after explicitly mentioning piggybacking on the compiler.
As for the number 4, this thing is called a "fat pointer" (remember, I'm not the one coining the terms here), and that's what's called \`fsome\` in this library.
If you are interested to learn more about the layout of \`some\` and \`fsome\`, there's a section in the README that tries to give a quick glance with a bit of terrible ASCII-graphics.
Examples? You can find the classic "Shapes" example boring after all these years, and I agree, but here it is just for comparison:
struct Shape : vx::trait {
virtual void draw(std::ostream&) const = 0;
virtual void bump() noexcept = 0;
};
template <typename T>
struct vx::impl<Shape, T> final : impl_for<Shape, T> {
using impl_for<Shape, T>::impl_for; // pull in the ctors
void draw(std::ostream& out) const override {
vx::poly {this}->draw(out);
}
unsigned sides() const noexcept override {
return vx::poly {this}->sides();
}
void bump() noexcept override {
// self.bump();
vx::poly {this}->bump();
}
};
But that's boring indeed, let's do something similar to the std::function then?
\`\`\`C++
template <typename Signature>
struct Callable;
template <typename R, typename... Args>
struct Callable<R (Args...)> : vx::trait {
R
Yet another modern runtime polymorphism library for C++, but wait, this one is different...
The link to the project on GitHub
And a godbolt example of std::function-like thingy (and more, actually)
Hey everyone! So as you've already guessed from the title, this is another runtime polymorphism library for C++.
Why do we need so many of these libraries?
Well, probably because there are quite a few problems with user experience as practice shows. None of the libraries I've looked at before seemed intuitive at the first glance, (and in the tricky cases not even after re-reading the documentation) and the usual C++ experience just doesn't translate well because most of those libraries do overly smart template metaprogramming trickery (hats off for that) to actually make it work. One of the things they do is they create their own virtual tables, which, obviously, gives them great level of control over the layout, but at the same time that and making these calls look
Obtaining type name strings
https://holyblackcat.github.io/blog/2025/09/28/type-names.html
https://redd.it/1nsmdx5
@r_cpp
Choosing a C++ to Python wrapper: Boost.Python vs pybind11?
I've built a code search tool as a terminal application in C++, and I'm now working on packaging it as a Python library. I need to create a Python wrapper for the C++ core.
My project already uses Boost, which has its own Python wrapper (Boost.Python). However, from what I've read, most people seem to be using pybind11.
For those who have experience with this, what are the pros and cons of the different options?
The search tool: https://github.com/perghosh/Data-oriented-design/releases/tag/cleaner.1.0.6
https://redd.it/1nsch76
@r_cpp
Member properties
I think one of the good things about C# is properties, I believe that in C++ this would also be quite a nice addition. Here is an example https://godbolt.org/z/sMoccd1zM, this only works with MSVC as far as I'm aware, I haven't seen anything like that for GCC or Clang, which is surprising given how many special builtins they typically offer.
This is one of those things where we could be absolutely certain that the data is an array of floats especially handy when working with shaders as they usually expect an array, we wouldn't also need to mess around with casting the struct into an array or floats and making sure that each members are correct and what not which on its own is pretty messy, we wouldn't need to have something ugly as a call to like vec.x() that returns a reference, and I doubt anyone wants to access the data like vec[index_x\] all the time either, so quite a nice thing if you ask me.
I know this is more or less syntax sugar but so are technically for-ranged based loops. What are your thoughts on this? Should there be a new keyword like property? I think they way C# handles those are good.
https://redd.it/1nrxmml
@r_cpp
implot not compatible with imgui version 1.92.2?
https://redd.it/1nrs33y
@r_cpp
I made a custom game Engine in c++ to create my own 2D Game, including physics, AABB Collision, and asset handling!
Hello Programmers! The following is devlog that showcases my custom c++ engine that I made from scratch using only SFML and ImGui for SFML. It goes over physics handling, as well as how I handle my assets and interpret input from the user as well!
Here is a link to the devlog:
https://youtu.be/wygFRa5g--I?si=CSp7h8qTATBjdSZD
Here is a link to the github:
https://github.com/NateTheGrappler
https://redd.it/1nrourf
@r_cpp
Informed poll
https://pigweed.dev/pw_async2/informed_poll.html
https://redd.it/1nr722h
@r_cpp
Material 3 Design Comes To Slint GUI Toolkit
https://slint.dev/blog/material-comp-1.0
https://redd.it/1nqvrl8
@r_cpp
Is there any way to show all "Closed Permanently" address on Google Maps?
If you aren't aware, Google will actually tell you if a listed address is permanently closed, which is very useful for finding abandoned places. But I haven't found a way to actually "browse" them, they don't have a unique indicator on the map (compared to an open address) and sometimes don't even show up at all unless you specifically search for that address (the building is just blank until you do so).
Is there any way to show all of them in a selected area, either through an official method in the app/site or some kind of bot? I’ve tried using this but I couldn’t figure out how to get it to work and it seems like I need to make my own custom script for it. It would be nice if someone could recreate this or a bot of some kind just for that very reason since I don’t know too much about this and how it’s not as easy as it looks: https://github.com/deqline/UrbexFinder
https://redd.it/1nqsqr3
@r_cpp
Update: Early Feedback and Platform Improvements
My last post got roasted and obliterated my karma (I'm new to reddit) but persistence is the key so I'm back to post an update.
What's New:
Guest Mode \- You can now use the platform without creating an account (thanks for the feedback!)
Concise Mode \- to cater to different audiences this mode reduces amount of text to consume, less yap more tap!
Content Strategy:
I intend to review the content but right now my focus is creating comprehensive coverage of topics at a high standard, with plans to refine and perfect each section iteratively.
My Philosophy: My commitment is to improve 1% at a time until its genuinely awesome.
Coming Next: Multi-file compilation support (think Godbolt but focused on learning) - essential for teaching functions and proper program structure.
I'm actively seeking feedback to improve the learning experience! If there's a feature you wish other C++ tutorials had but don't, I'd love to hear about it - user-suggested improvements are a top priority for implementation.
Check it out if you're curious! If you're new to programming or run into any issues, feel free to reach out. Happy coding!
http://hellocpp.dev/
https://redd.it/1nql4ti
@r_cpp
GSoC 2025: Improving Core Clang-Doc Functionality
https://blog.llvm.org/posts/2025-gsoc-clang-doc/
https://redd.it/1nql0ot
@r_cpp
Advice on learning C++ to crack platform role interviews.
Hi everyone,
I’ve spent my career working in startups with a background in robotics, which has given me broad cross-functional exposure that I’ve really enjoyed. Now, I’m looking to transition into larger organizations where C++ is used to build generic backends and middleware for autonomous systems.
Although I don’t have a formal CS background, I’ve built applications on top of frameworks like ROS and NVIDIA DriveWorks. I’ve always been interested in developing frameworks like these, which is why I started applying for such roles. However, after several unsuccessful interviews, I realized that my C++ experience hasn’t been at the abstract, systems-level depth these positions require.
I’ve reached out to people in the field but haven’t received responses, so I’m turning here for guidance. I’d love to hear from professionals at NVIDIA, Nuro, Waymo, or similar companies working on backend or generic C++ code for autonomous vehicles. Specifically, I’d like advice on:
The best resources to learn the concepts these roles require
How to practice and build the right skills to succeed in interviews
Any guidance would be greatly appreciated!
https://redd.it/1npw604
@r_cpp
local network
How can I simulate or observe device communication on a local network with multiple routers on the same switch for educational purposes ;)?
https://redd.it/1nppslu
@r_cpp
operator() (Args... args) {
return call(args...);
}
private:
virtual R call(Args... args) = 0;
};
template <typename F, typename R, typename... Args>
struct vx::impl<Callable<R (Args...)>, F> : vx::impl_for<Callable<R (Args...)>, F> {
using vx::impl_for<Callable<R (Args...)>, F>::impl_for; // pulls in the ctors
R call(Args... args) override {
return vx::poly {this}->operator()(args...);
}
};
```
you can see the example with the use-cases on godbolt (link at the top of the page)
It will be really nice to hear what you guys think of it, is it more readable and easier to understand? I sure hope so!
https://redd.it/1npkris
@r_cpp
Yet another modern runtime polymorphism library for C++, but wait, this one is different...
The link to the project on [GitHub](https://github.com/AVasK/some)
And a [godbolt example of std::function-like thingy (and more, actually)](https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGe1wAyeAyYAHI%2BAEaYxCAAnKQADqgKhE4MHt6%2BekkpjgJBIeEsUTHxdpgOaUIETMQEGT5%2BXLaY9nkM1bUEBWGR0XG2NXUNWc0KQ93BvcX9sQCUtqhexMjsHOYAzMHI3lgA1CYbbggEBAkKIAD0l8RMAO4AdMCECF4RXkorsowED2gslwAggA1JgKADSlwUqDYN0wVAUlwQmCY6ERLCYwShMMwDwQCQSh2wJg0gJJZLMWwYOy8%2B0OblECk%2BBCJ5M2212mAORwIAE8EpgAPoEW6EBSs0nk657egEMAcBR7O7EQhc6FsAgIYLAPYpFh0Wp7Ii6gjoEAg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RSCBCmEUEo2RkipAEIxjjuQ0g9DY/0MYrQ%2B1VAmDx4TbQxNdAE30GIYxxOeEaHoE5dRZMzHkzRpYKwwOKuVYG5dwaOCq29RmBQ6bwLZoeHmvYhbi0PDLfaXAhBB6bBDrwftWgo6kCtWYWWDwbWxFlsa0%2BNqNA%2Bo0HBOCcHOABtIGqjVWqOChpAOGzzCrSDRsQCAP%2BTUCBJogCm%2BgxBQhHk4KoG1p9NqmeAMgZA%2Bt/OkeY/gLCeAzTNH4MB%2BiYHpCdcgyodQhnYOkGVEwBIt69McBVfFoNSXAy2zyxskzkgzMWZ9FZmzdm4IOZERADwnZU1GvcxG5d3nfOnwcxobNZgbUbDgpIU%2BstZaPf0LFgziWQ22FSydrzk2msJbI599L3n70pGcJIIAA%3D%3D%3D)
Hey everyone! So as you've already guessed from the title, this is another runtime polymorphism library for C++.
Why do we need so many of these libraries?
Well, probably because there are quite a few problems with user experience as practice shows. None of the libraries I've looked at before seemed intuitive at the first glance, (and in the tricky cases not even after re-reading the documentation) and the usual C++ experience just doesn't translate well because most of those libraries do overly smart template metaprogramming trickery (hats off for that) to actually make it work. One of the things they do is they create their own virtual tables, which, obviously, gives them great level of control over the layout, but at the same time that and making these calls look
Fuzzing at Boost
https://www.boost.org/doc/contributor-guide/testing/fuzzing.html
https://redd.it/1npke3t
@r_cpp