-
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
C++ COMPLETE roadmap for study
Hi everyone
I asked chat gpt to create a COMPLETE roadmap of C++ so i wanted to know if its really good and COMPLETE.
Thats he send:
# C++ ULTRA-COMPLETE – Ultimate Roadmap
# Level 1 – Language Fundamentals
# 1. Data Types
1.1 Primitive types: int, float, double, char, bool
1.2 Modifiers: signed, unsigned, short, long
1.3 Constants and literals: const, constexpr, #define
1.4 Derived types: arrays, pointers, references
1.5 Special types: void, nullptr, auto, decltype
1.6 Structs and unions
1.7 Enumerations: enum, enum class
1.8 typedef and using
1.9 Advanced literals: binary (0b1010), digit separators (1'000'000)
1.10 Character types and strings (char, wchar_t, char16_t, char32_t)
# 2. Operators
2.1 Arithmetic: +, -, *, /, %, ++, --
2.2 Relational: ==, !=, <, >, <=, >=
2.3 Logical: &&, ||, !
2.4 Bitwise: &, |, ^, ~, <<, >>
2.5 Assignment: =, +=, -=, *=, /=, %=
2.6 Increment/decrement prefix/postfix
2.7 Ternary operator ?:
2.8 Comma operator ,
2.9 Pointer operators: *, &, ->
2.10 Casts: static_cast, dynamic_cast, reinterpret_cast, const_cast
2.11 Memory-related operators: sizeof, alignof
2.12 Rare operators: .*, ->*
# 3. Control Flow
3.1 Conditionals: if, else if, else, switch
3.2 Loops: for, while, do-while
3.3 Flow control: break, continue, return, goto
3.4 Exceptions: try, catch, throw
3.5 Rare/legacy: setjmp / longjmp (C legacy)
# 4. Functions
4.1 Declaration and definition
4.2 void and return-value functions
4.3 Pass-by-value, pass-by-reference, pointers
4.4 Default parameters
4.5 Function overloading
4.6 Inline and recursive functions
4.7 Lambda expressions (C++11+)
4.8 Anonymous functions capturing variables
4.9 Functions returning pointers and references
4.10 Virtual, pure, and abstract functions (OOP)
4.11 Function templates and template specialization
4.12 Variadic functions (...) and variadic templates
4.13 constexpr, consteval, and constinit functions
# Level 2 – Pointers, Memory, and Data Structures
# 5. Pointers and References
5.1 Pointer concept and operators * and &
5.2 Pointer-to-pointer
5.3 Constant pointers and pointers to constants
5.4 Function pointers
5.5 Object pointers
5.6 Simple and constant references
5.7 R-value references (&&)
5.8 Smart pointers: unique_ptr, shared_ptr, weak_ptr, auto_ptr (deprecated)
5.9 Pointers and multidimensional arrays
5.10 Pointer-to-member (int Class::* ptr)
# 6. Dynamic Memory Allocation
6.1 new and delete
6.2 Dynamic arrays (new[], delete[])
6.3 Dynamically allocated objects
6.4 Pointers to objects and arrays of objects
6.5 Memory management and leaks
6.6 RAII (Resource Acquisition Is Initialization)
6.7 Custom allocators (std::allocator)
6.8 Placement new
6.9 Aligned allocation (alignas)
# 7. Data Structures
7.1 Arrays and matrices
7.2 Strings (char[], std::string, std::wstring)
7.3 Structs, unions, enumerations
7.4 Singly and doubly linked lists
7.5 Stacks, queues, and priority queues
7.6 Vectors (std::vector)
7.7 Deques (std::deque)
7.8 Maps (std::map, std::unordered_map)
7.9 Sets (std::set, std::unordered_set)
7.10 Tuples (std::tuple) and pairs (std::pair)
7.11 Iterators and iterator adapters
7.12 STL algorithms (sort, find, for_each, etc.)
# Level 3 – Object-Oriented Programming (OOP)
# 8. Basic Concepts
8.1 Classes and objects
8.2 Encapsulation (public, private, protected)
8.3 Constructors and destructors
8.4 Default, parameterized, and copy constructors
8.5 Member initialization (initializer lists)
8.6 Methods: const, static, overloading
# 9. Inheritance and Polymorphism
9.1 Single and multiple inheritance
9.2 Access specifiers: public, protected, private
9.3 Static polymorphism (overloading)
9.4 Dynamic
Parallel C++ for Scientific Applications: Linear Algebra in C++
https://www.youtube.com/watch?v=XzUTLsWyErA
https://redd.it/1p37sgg
@r_cpp
What is the most modern way to implement traits/multiple dispatch/multiple inheritance?
I am coming back to C++ after a few years of abstinence, and have since picked up on traits and multiple dispatch from Rust and Julia, and was hoping that there is an easy way to get the same in C++ as well.
Usually i have just written a single virtual parent class, and then i had a container of pointers onto children. This was ok for smaller use cases and did polymorphism fine, but it would fail if i would like to implement more interfaces/traits for my objects. I.e. i want to have shapes, several are movable, several others are also scalable, not all scalables are also movable.
What should i look into? I am pretty confused, since C++ does C++ things again, and there does not seem to be a single unified standard. There seems to be multiple inheritance, which i think would work, but i learned i should never ever ever do this, because of diamond inheritance.
Then there seem to be concepts, and type erasure. This seems to have a lot of boiler plate code (that i don't totally understand atm).
There also seems to be some difference between compile time polymorphism and run time polymorphism. I do not want to have to suddenly refactor something, just because i decide i need a vector of pointers for a trait/concept that previously was defined only in templates.
What would you use, what should i learn, what is the most future proof? Or is this a case of, you think you want this, but you don't really?
https://redd.it/1p353bp
@r_cpp
A 2-hour video trashing C++ made me better at C++
https://youtu.be/7fGB-hjc2Gc?si=Pdtce5uFKpMsUqkg
https://redd.it/1p2y8q9
@r_cpp
Thinking of moving to C++
So to make a super long story short, I graduated a couple years ago with a bachelors in software development. Learned and starting doing more with C#, shortly after that I had a job offer. But I needed to have lung surgery and would need a lot of time off and the offer was withdrawn (hindsight I should have not said anything until after I started lol ) and had a long recovery and health issues.
Im back to 100% and havent done much coding or anything in that gap of time while I was sick. Id like to get back in to it but deciding between going back in to C# or pivoting and learning C++. C++ I think is more prevalent in career fields Id enjoy, aerospace, embedded, games (though realistically probably not where id actually go), and some government work.
I also know C# can be used in those fields as well, but I did really enjoy the few C++ courses I had back in school and its intrigued me ever since. So really im stuck deciding if I do C# and then try to move to a C++ role after some experience, or just go for C++ off the rip. I know entry level is gonna be difficult for both but feel like itd be even more so for C++. Im also in Missouri and not sure how prevalent C++ even is here, though im also not opposed to moving ha.
https://redd.it/1p2g2ca
@r_cpp
Simple MPSCQueue with explanation
My previous post got deleted because It seems like AI detector has disliked the "polished" style of the post. I guess it should be rewritten in a more "casual" way, with grammar errors. Sorry for duplication if anyone has seen this already.
\----
During my free time, I have stumbled upon such segment of C++ as "low latency" and "lock free". This topic has initially fascinated me so much, because I couldn't have even imagined that some thing like this could even exist, and is actively used in a very interesting and specific segment of the market... But that is a story for another time :)
I have decided to get familiar with the topic, and as my first step, I wanted to implement something. I have chosen MPSC (Multiple Producer, Single Consumer) queue, but I've quickly realised that the entry barrier is overly high. I literally had no understanding of where I could start.
I spent several weeks gathering knowledge bit by bit, studying advanced multithreading, atomics, memory ordering, and lock-free algorithms. Finally I came up with something I want to share here.
I thought it would be valuable to create a detailed walkthrough, which can be used either by me in future, when I get back to this in maybe several month or years, my friends who would love to learn about this topic, or anyone else who would find themselves in a situation like this.
This project is for sure not the best, not ideal, and not something universe-changing. It is just a "school-grader-level" project with the explanation, hopefully understandable to the same "school-grader".
I, personally, would have loved to have an article like this while I was learning, since it could save at least several weeks, so I hope it helps others in the same way.
https://github.com/bowtoyourlord/MPSCQueue
Any critics welcome.
https://redd.it/1p2bizu
@r_cpp
2025"**](https://youtube.com/watch?v=EyTSuFJ0Too&utm_source=techtalksweekly&utm_medium=email) ⸱ **+100 views** ⸱ 19 Nov 2025 ⸱ 01h 06m 11s tldw: A practical tour of C++ command-line tooling with demos that shows when compilers, linkers, and other old-school tools beat IDEs and why it's worth learning.
# ACCU 2025
1. [**"The Past, Present and Future of Programming Languages - Kevlin Henney - ACCU 2025"**](https://youtube.com/watch?v=8-3QwoAmyuk&utm_source=techtalksweekly&utm_medium=email) ⸱ **+3k views** ⸱ 14 Nov 2025 ⸱ 01h 30m 21s tldw: See how programming languages encode ways of thinking, why progress feels slow, and how trends like FOSS and LLMs might reshape code, definitely worth watching for everyone.
2. [**"The Definitive Guide to Functional Programming in Cpp - Jonathan Müller - ACCU 2025"**](https://youtube.com/watch?v=lvlXgSK03D4&utm_source=techtalksweekly&utm_medium=email) ⸱ **+1k views** ⸱ 16 Nov 2025 ⸱ 01h 09m 26s tldw: Functional programming in C++ is actually practical with the modern standard library, covering std::ranges, composable error handling with std::optional and std::expected, algebraic data types, separating IO from computation, and yes the M-word, worth a watch.
3. [**"What C++ Needs to be Safe - John Lakos - ACCU 2025"**](https://youtube.com/watch?v=6-MrKxsR__I&utm_source=techtalksweekly&utm_medium=email) ⸱ **+600 views** ⸱ 19 Nov 2025 ⸱ 01h 31m 24s tldw: With governments pushing memory-safe languages, this talk maps concrete technical proposals, like Contracts, handling erroneous behavior, and Rust-like checked relocation, that could realistically make C++ safe again and is worth watching.
# CppNorth 2025
1. [**"Lightning Talks - CppNorth 2025"**](https://youtube.com/watch?v=V5kgi0gfh7M&utm_source=techtalksweekly&utm_medium=email) ⸱ **+100 views** ⸱ 17 Nov 2025 ⸱ 01h 52m 16s tldw: -
# Podcasts
1. [**"Episode 260: 🇳🇱 C++ Under the Sea 🇳🇱 Ray, Paul, Parrot & Scanman!"**](https://feeds.buzzsprout.com/1501960.rss?utm_source=techtalksweekly&utm_medium=email) ⸱ *ADSP (Algorithms + Data Structures = Programs)* ⸱ 14 Nov 2025 ⸱ 00h 24m 11s tldl: A deep dive into C++ under real GPU workloads explores scans, Parrot, and modern parallel patterns in a way that makes you want to rethink how you write high-performance code.
Please let me know what you think about this format in the comments. Thank you 🙏
https://redd.it/1p26od7
@r_cpp
Do these posix socket functions completely overwrite the addr variable?
In this code snippet I am trying to reuse the addr variable to read multiple socket addresses into it under the assumption that functions like getsockname, getpeername *completely* overwrite the `addr` bits. Is my assumption correct? I am trying to reuse my variables here instead of creating new ones.int main(int argc, char **argv) {int fd = socket(AF_INET, SOCK_STREAM, 0);if (fd < 0) {die("socket()");}struct sockaddr_in addr = {};addr.sin_family = AF_INET;addr.sin_port = htons(1234);addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);int rv = connect(fd, (const struct sockaddr *)&addr, sizeof(addr));socklen_t len = sizeof(addr);unsigned short client_port = 0;if (!getsockname(fd, (struct sockaddr *)&addr, &len)) {client_port = ntohs(addr.sin_port);}if (rv) {die("connect");} else {socklen_t len = sizeof(addr);int remote = getpeername(fd, (struct sockaddr *)&addr, &len);if (remote) {printf("error getting remote address\n");} else {char ip[INET_ADDRSTRLEN];inet_ntop(AF_INET, &addr.sin_addr, ip, sizeof(ip));printf("connected to server @ <%s:%d>", ip, ntohs(addr.sin_port));}if (client_port != 0 && remote == 0)printf(" | client port <%d>\n", client_port);}const char *data = argc > 1 ? argv[1] : "hello!";write(fd, data, strlen(data));char rbuf[64] = {};ssize_t n = read(fd, rbuf, sizeof(rbuf) - 1);if (n < 0) {die("read");}printf("server says: %s\n", rbuf);close(fd);return 0;}
https://redd.it/1p25aru
@r_cpp
I built a small 5G KPI extractor for 5G base station generated logs (c++, no dependecies) as part of 5G Test Automation Project. The core parsing and KPI logic is in place but it still misses an intelligent visualization/dashboard layer
https://github.com/nidalaburaed/5GBTSLogAnalyzer
https://redd.it/1p1z74f
@r_cpp
Undefined Behavior From the Compiler’s Perspective
https://youtu.be/HHgyH3WNTok?si=8M3AyJCl_heR_7GP
https://redd.it/1nxmlv3
@r_cpp
Can someone explain this
So im doing Socket programing in C using winsoc2 and im donw with my server-socket now im programing my client-socket but i dont get this :
\#define DEFAULT_PORT "27015"
// Resolve the server address and port
iResult = getaddrinfo(argv[1\], DEFAULT_PORT, &hints, &result);
if (iResult != 0) {
printf("getaddrinfo failed: %d\\n", iResult);
WSACleanup();
return 1;
}
https://redd.it/1nx5arl
@r_cpp
C++26: std::optional<T&>
https://www.sandordargo.com/blog/2025/10/01/cpp26-optional-of-reference
https://redd.it/1nwxe0x
@r_cpp
The problem with inferring from a function call operator is that there may be more than one
https://devblogs.microsoft.com/oldnewthing/20251002-00/?p=111647
https://redd.it/1nwtv47
@r_cpp
Eigen 5.0.0 has been quietly released
https://gitlab.com/libeigen/eigen/-/releases/5.0.0
https://redd.it/1nwfjc8
@r_cpp
not be queried: https://godbolt.org/z/r19185rqr**
Which means one can not put a hypothetical `noconvert(bool)` annotation on a parameter for which one would not like implicit conversions on the python side. (Or rather, one can not find the annotation with `annotations_of()`).
The alternative is to annotate the function with an array-like list of indices for which implicit conversions are undesirable. This is a pretty error prone option that is brittle in the face of refactoring and signature changes.
I know that annotations and function parameter reflections have moved through WG21 in parallel and hence the features don't work with one another, but annotating parameters would be quite useful.
**Parameter reflections can't give us default values of the reflected parameter**
This is a can of worms. Default values need not be constant expressions, need not be consistent between declarations, and [can even "stack"](https://godbolt.org/z/Ycf9hdxxr).
However, the lack of ability to get some sort of reflection on the default value of a parameter paints us in a corner where we have to bind the same function multiple times, always wrapped in a lambda, to emulate calling a function with different number of arguments.
Here's an example: https://godbolt.org/z/Yx17T8fYh
Binding the same function multiple times creates a runtime overload set, for which pybind11 performs runtime overload resolution in a case where manual binding completely avoids the runtime overloading mechanisms.
Yes, my example with `int y = 3` parameter is very simple and avoids all the hard questions.
From where I stand, it would be enough to be able to splice a token sequence matching the default argument value.
There is a case that I don't know how I'd handle: https://godbolt.org/z/Ys1nEsY6r
But this kind of inaccessible default parameters could never be defaulted when it comes to pybind11.
## Conclusion
C++26 Reflections are amazing and the upcoming token sequences would make it even more so.
Still, there is a thing or two that I have not noticed is in planning for C++29. Specifically:
- Function parameter annotations and reflection of default values would be extremely useful. If there's one thing I'd like to get in the future, it's this one.
- Range splicers, of the form `[:...range:]` would clean up some things too.
- Template annotations as a distant 3rd for automatically generating bindings for template instantiations.
So that I don't end on a note that might look entitled, once again, a sincere thank you to everyone involved in C++ Reflections.
EDIT1: Fixed sloppy wording when it comes to parameter annotations.
https://redd.it/1nw39g4
@r_cpp
Chip 8 emulator
hey
I'm writing a chip8 emulator in cpp and it's my github link : https://github.com/Dav-cc/Chip-9
it's not completed yet but it's my pleasure to you guys seeing this codes and give me advices for rest of it It's my first project in cpp (I have experience in C development for almost 2years)
https://redd.it/1p39p9e
@r_cpp
GitHub - abdomody35/agent-sdk-cpp: A modern, header-only C++ library for building ReAct AI agents, supporting multiple providers, parallel tool calling, streaming responses, and more.
https://github.com/abdomody35/agent-sdk-cpp
https://redd.it/1p37bg2
@r_cpp
Practical Security in Production: Hardening the C++ Standard Library at massive scale
https://queue.acm.org/detail.cfm?id=3773097
https://redd.it/1p30v8y
@r_cpp
[C++ Day 2025] 8 Queens at Compile Time (Marco Marcello, Jonathan Marriott)
https://www.youtube.com/watch?v=aAY4RX2gtD0
https://redd.it/1p2vf9k
@r_cpp
Seeking Programmers for a User Study to Evaluate a Training Program to Teach Fuzzing
https://pwn.college/fuzz~c7f7b8c2/
https://redd.it/1p2axnw
@r_cpp
I tried videos... I tried courses...
I tried websites...(yes even learn CPP website) i tried audiobooks... i tried spotify... I even tried 2 different LLMs...
And in the end... I bought a physical book...
"C++ All In One for Dummies by John Paul Mueller"
This is the best $50 I have ever spent.(I probably spent over $100 on tutorials alone) I've probably watched hundreds of hours of tutorials through video and listening and following along and none have helped me understand the concepts, each individual character and it's placement. I spent all day running around to book stores yesterday to find it and got a last copy physically available at a Barnes and Noble.(Recomended for absolute beginners with easy reading) After skimming through it in the book store I KNEW I had it!
I know everyone learns differently but I've taken this with me when I go out driving and open it up when I'm on break or have down time.
Now, I know it ain't C++ primer 5th edition but I'm already past page 100 and have a much better time recalling information. If you're struggling to learn C++ or programming in general heres my advice(super limited) that I learned earlier this week when googling: Why is it so hard to learn this stuff? Especially when I'm very good at following logic in conversation or methodology. I should be able to translate that basic understanding into a new language that's just as explicit right?
What I discovered was something so obvious yet bold. A few different reddit posts with other people struggling to learn their own various programming languages. (Which i will grab the links to later if you REAAALLY need sources)
The commentary on those posts is summarized as follows:
Turn off the videos. Turn off the tutorials. Turn off the LLMs. Turn off your computer. Turn off your phone.
Open a book, sit down, and learn the hard way.
Between you and me, it has been a PEHNOMINAL GAME CHANGER after only a day and a half of just sitting down, reading, and thinking about the context. Flipping back and forth from page to page to rediscover and refresh how one topic blends into the next.
I hope this helps someone else out there. :)
Ps: Any 'pointers' 😉 from the cpp community for someone who's excitement to learn cpp has been reignited?
https://redd.it/1p2cbxn
@r_cpp
C++ Podcasts & Conference Talks (week 47, 2025)
Hi r/cpp!
As part of [Tech Talks Weekly](https://www.techtalksweekly.io/), I'll be posting here every week with all the latest C++ conference talks and podcasts. To build this list, I'm following over [100 software engineering conferences](https://www.techtalksweekly.io/i/170091550/conferences) and even more podcasts. This means you no longer need to scroll through messy YT subscriptions or RSS feeds!
In addition, I'll periodically post compilations, for example a list of the most-watched C++ talks of 2025.
The following list includes all the C++ talks and podcasts published in the past 7 days (2025-11-13 - 2025-11-20).
Let's get started!
# Podcasts
# CppCon 2025
1. [**"Concept-based Generic Programming - Bjarne Stroustrup - CppCon 2025"**](https://youtube.com/watch?v=VMGB75hsDQo&utm_source=techtalksweekly&utm_medium=email) ⸱ **+15k views** ⸱ 14 Nov 2025 ⸱ 01h 23m 29s tldw: You'll learn about concept-based generic programming with practical examples, including a tiny type system that prevents narrowing and enforces range checks and walks through design rationale, relations to OOP, and C++26 static reflection, worth watching if you write generic C++.
2. [**"Implement the C++ Standard Library: Design, Optimisations, Testing while Implementing Libc++"**](https://youtube.com/watch?v=iw8hqKftP4I&utm_source=techtalksweekly&utm_medium=email) ⸱ **+3k views** ⸱ 18 Nov 2025 ⸱ 01h 01m 07s tldw: A practical tour of libc++ showing space packing tricks, wait and iterator optimisations, and rigorous testing techniques that’s worth watching if you care about squeezing performance and correctness out of C++ standard library code.
3. [**"The Evolution of std::optional - From Boost to C++26 - Steve Downey - CppCon 2025"**](https://youtube.com/watch?v=fTbTF0MUsPA&utm_source=techtalksweekly&utm_medium=email) ⸱ **+2k views** ⸱ 17 Nov 2025 ⸱ 00h 59m 49s tldw: See how std::optional evolved from Boost to C++26 to learn why optional references are so tricky, what landed (range support and optional), and how those design tradeoffs reshape sum types, lifetime safety, and everyday C++ code; watch this talk.
4. [**"Could C++ Developers Handle an ABI Break Today? - Luis Caro Campos - CppCon 2025"**](https://youtube.com/watch?v=VbSKnvldtbs&utm_source=techtalksweekly&utm_medium=email) ⸱ **+1k views** ⸱ 19 Nov 2025 ⸱ 01h 03m 19s tldw: This talk asks whether C++ developers could handle an ABI break today, examines libstdc++'s history, common library ABI pratfalls, and how tools like Conan and vcpkg mitigate risk, and argues the pain might be less than we fear so give it a watch.
# Meeting C++ 2025
1. [**"Casts in C++: To lie... and hopefully - to lie usefully - Patrice Roy - Meeting C++ 2025"**](https://youtube.com/watch?v=spxCeWT-GrA&utm_source=techtalksweekly&utm_medium=email) ⸱ **+400 views** ⸱ 15 Nov 2025 ⸱ 01h 11m 37s tldw: This talk explains why we sometimes lie to the compiler, what each cast actually does, when writing your own makes sense, and practical tips to avoid surprises, so watch it.
2. [**"Does my C++ Object Model Work with a GPU and Can I Make It Safe - Erik Tomusk - Meeting C++ 2025"**](https://youtube.com/watch?v=OSGDH_oK2s0&utm_source=techtalksweekly&utm_medium=email) ⸱ **+300 views** ⸱ 13 Nov 2025 ⸱ 01h 01m 25s tldw: This talk answers whether C++'s object model can work with GPUs and be made safe, using code examples, accelerator API design, and hardware details that matter for real time and safety critical systems.
3. [**"Designing an SPSC Lock free queue - Quasar Chunawala - Meeting C++ 2025"**](https://youtube.com/watch?v=mus6djSJLLc&utm_source=techtalksweekly&utm_medium=email) ⸱ **+200 views** ⸱ 17 Nov 2025 ⸱ 00h 56m 55s tldw: A back to basics talk that walks from a mutex and condition variable producer consumer queue through semaphores, atomics, memory ordering, and CAS to a practical lock free SPSC queue, worth watching if you want solid, practical concurrency knowledge.
4. [**"Command Line C++ Development - Mathew Benson - Meeting C++
how to sandbox a c++ child process on MacOSX?
So here is what I want to do:
I have a parent process that is trusted. I want this parent process to run a child process, which is untrusted.
The child can be an arbitrarily sourced script, or just written pooly. I want it run safely, without worrying (too much) about the child "doing bad things".
The child will communicate to it's parent via message-passing, probably via shared-memory.
These child will be a script, in a language that I have made, and run in a VM. However, this VM has access to low-level unix functions, like exec/kill/open/read/write/remove/etc. This is fine for trusted scripts.
But for untrusted scripts, it is not acceptable.
Instead, I want to block access to almost all syscalls. I've seen proposals like disable(): https://www.reddit.com/r/osdev/comments/1mpphmo/adding\_a\_disable\_syscall/ But of course... this does not exist yet.
OpenBSD has a "pledge()" call. But I need this on OSX.
I've heard of `ptrace()`being used to acheive this. I don't know how to do this. Does this work well on MacOSX?
Obviously... the idea is to acheive this workflow:
1. Parent sets up shared-memory for communication
2. Parent calls fork
3. Forked child drops most of the permissions or abilities
4. Forked child calls exec()
5. Exec'd child then has to drop the permission to call exec!
6. Exec'd child finally does the required work
Something like that. That or something simpler that acheives the same goal.
I don't need this immediately, but sometime before 3 months I will want this. But I can start today if I get good info today.
https://redd.it/1p249qy
@r_cpp
Declaring bit fields with position as well as number of bits
I would love it if I could specify the bit position as well as the number of bits in a bit field, something like:struct S { uint32_t x : 0, 5; // Starts at position 0, size is 5 so goes up to position 4 uint32_t z : 18, 3; // Starts at position 18, size is 3 so goes up to position 20 uint32_t y : 5, 11; // Starts at position 5, size is 11 so goes up to position 15 }
Does anyone know if there are any proposals in the works to add something like this?
Of course there are many pitfalls (e.g. error/warn/allow overlapping fields?) but this would be useful to me.
I considered building some template monstrosity to accomplish something similar but each time I just fool around with padding fields.
https://redd.it/1nxnjqr
@r_cpp
Is C/C++ tooling and dependency management still a pain point in 2025?
Coming from modern ecosystems like JavaScript's npm/uv or Rust's Cargo, the experience with C++ build systems and package managers often feels... cumbersome. Tools like vcpkg and Conan exist, but is anyone else still frustrated with the overall workflow? Do we need a simpler, more intuitive approach, or have the existing tools solved these problems for you?
https://redd.it/1nx73wd
@r_cpp
Parallel C++ for Scientific Applications: Monte Carlo Methods
https://www.youtube.com/watch?v=FEkrPKaBE38
https://redd.it/1nx1c7k
@r_cpp
MyProtocol Web Server: Learn how to implement protocol over TCP
https://www.youtube.com/watch?v=GuNrcZTr0ds
https://redd.it/1nwu741
@r_cpp
C++ code
Anyone can guide to that how and from where to start c++ as a freshman in CS!!
https://redd.it/1nwszfd
@r_cpp
What's a C++ feature you avoided for years but now can't live without?
https://redd.it/1nwbcja
@r_cpp
A Month of Writing Reflections-based Code: What have I learned?
## Preface
I have been trying to automate writing my own pybind11 binding code with the help of C++26 reflections, as implemented by [clang-p2996](https://github.com/bloomberg/clang-p2996).
There were moments where things went smoothly, but also moments where I missed a feature or two from the world of reflections. Then there is also accidental complexity caused by pybind11 having features which are, at the very least, not friendly for generic binding generation.
Before I begin, a massive thanks to Barry Revzin, Daveed Vandevoorde, Dan Katz, Adam Lach and whoever else worked on bringing Reflections to C++.
## Smooth sailing
What we got from the set of reflections papers is awesome. Here's an example of what can be achieved quite easily:
https://godbolt.org/z/jaxT8Ebjf
With some 20 lines of reflections, we can generate bindings that cover:
- free functions (though not overload sets of free functions - more on that later)
- structs/classes with
- a default constructor
- member functions
- data members, though always writable from python
You can also see how this easily generalizes to all other kinds of `py_class.def_meow(...)`. Almost...
Since C++ does not have "properties" in the python sense, `def_property_meow` will need [special care](https://godbolt.org/z/MT5ojzG4n).
As the `def_property` example shows, customizing the generated bindings is possible with `[[=annotations]]`.
So far... this is AWESOME. Looks like we can make bindings for whatever C++ entity we fine.
Well, let's talk about the not so awesome parts of this adventure. In order from least troublesome to most troublesome
## Splicing ranges
Pybind11 likes to work with template parameter packs, but C++26 often leaves us with `std::vector<std::meta::info>`.
We can deal with this in multiple ways:
Options are:
- good old [`index_sequece`](https://godbolt.org/z/5vEM7dWhr)
- [structured bindings can introduce a pack](https://godbolt.org/z/GooGTsWdc)
- But constexpr structured bindings have not been implemented yet in clang-p2996
And one thing that didn't end up in [P2996](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2996r13.html#range-splicers) are [range splicers](https://godbolt.org/z/TPWqv3jss).
So this can be done. Depending on the context, it can even look elegant, but I often missed costexpr structured bindings and ended up reaching for `index_sequence` a lot.
Range splicers would have been nice, but I can live without them.
## Code duplication due to pybind11 design
Pybind11 has a lot of similar functions with different names:
`def` vs `def_static` vs `def_property` vs `def_property_readonly` vs ...
Then there are also things whose mere presence alters what pybind11 is doing, without a no-op state:
`is_final` for classes, `arithmetic` for enums and so on.
These can be handled with an `if constexpr` that branches on existence of annotation, however, this leads to a lot of code duplication.
Here, token sequences as described in https://wg21.link/P3294 would remove most of repetition. For the `def_meow` stuff, an approximate reduction in amount of code is ~10x.
## Pure virtual bases
To use these with pybind11, users need to write ["trampolines"](https://godbolt.org/z/ffPKE7Gxb), because it needs to be able to instantiate a python object representing the base class object.
C++26 still can't generate types that have member function, but this will be solved with https://wg21.link/P3294
## Templates can't be annotated
It would be useful to annotate member function templates with something like
template_inputs({
{.name = "T1Func", .args = {^^T1}},
{.name = "T2T3Func", args = {^^T2, ^^T3}}
})
And then bind the same template multiple times, under different names and with different template arguments. However [that's not possible right now](https://godbolt.org/z/qx5c1v417). Can templates even have attributes and annotations?
## Function parameter missing features
**Parameter annotations can