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
std::formatter specialization for smart pointers

Currently something like

std::uniqueptr<int> uptr = std::makeunique<int>(42);
std::shared
ptr<int> sptr = std::makeshared<int>(42);
std::println("uptr: {}", uptr);
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: " << uptr << '\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.

https://redd.it/1ufjvur
@r_cpp
Am I the only one who thinks this? (about enum)

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"
};

https://redd.it/1uflgw3
@r_cpp
An Invitation For a Controlled Experiment

Hello.
I am a self-taught operator/software designer.
I developed Anubis. A cpp forensic AI weights scanner.
I tested Anubis against algorithms of my design and I think it has matured enough for outsider testing.

I propose a rigorous, controlled experiment where a corporation or even professionals to send or share any format of weights with any kind of payloads in them to test Anubis's efficacy and detection capabilities.

We -both me and the whoever is interested in collaboration- will adhere to ISO/IEEE standards in experiment design, reporting and final whitepapers or documents resulting from this experiment.

I offer NO FINANCIAL COMPENSATION. This is a scientific experiment.

Please DM or leave a comment if you are:

1. Serious
2. a Professional
3. Know what ISO/IEEE frameworks are

\---
Cheers!

https://redd.it/1ug3cyr
@r_cpp
projections for stl data structures

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

https://redd.it/1ug7vd3
@r_cpp
SoA

I am working on a universal SoA library that will leverage C++ reflection. If you're interested in contributing, comment or DM. The first draft is on a private repo for now.

https://redd.it/1uh53rs
@r_cpp
libc

Is what I'm saying correct or not? Doesn't every Linux system need to include glibc so that user-space programs, like Bash, can invoke system calls? In other words, glibc provides the wrappers that let C programs make system calls without me having to write assembly and execute the syscall instruction manually. Is that correct?

https://redd.it/1uhdr25
@r_cpp
Best resources for LLD and HLD using C++? (Is Shrayansh Jain's playlist too theory-heavy?)

Hey everyone,

I’m currently preparing for a role switch and looking for solid, structured resources to master both Low-Level Design (LLD) and High-Level Design (HLD). My primary and preferred programming language is C++.

One of my seniors strongly recommended Shrayansh Jain's (Concept & Coding) LLD and HLD playlists on YouTube. I don’t mind investing in the channel membership if it’s genuinely worth it, but looking through the structure, it feels a bit theory-heavy. I learn best when things are highly practical and implementation-focused rather than just purely conceptual.

For those who have taken it or used other resources:

1. Is Shrayansh's course worth it if my goal is to implement a machine-coding round?
2. Since most popular LLD content out there is flooded with Java/Spring Boot examples, what are the best high-signal resources, repositories, or playgrounds for handling LLD specifically in C++?
3. Any gold-standard recommendations for HLD that focus heavily on practical trade-offs rather than generic theoretical architectures?

Appreciate any leads, GitHub repos, or course suggestions. Thanks!

https://redd.it/1uhv7cu
@r_cpp
I'm building a Cargo-like build system for C++. Currently at v0.3.0 with automatic CMake migration. Looking for feedback.

Hey r/cpp!



I'm a 14-year-old, and I've spent my summer building \`deft\` — a build system for C++ that works like Cargo.



Current status:

* **Core Engine:** High-performance, zero-dependency C/C++ build system written in Rust.
* **Build Optimization:** Global build caching and strict toolchain pinning are fully functional.
* **Manifest Support:** Custom, dependency-free TOML parser handles basic profiles (`[profile.c]`, `[profile.cpp]`), language standards, optimization levels, macro definitions (`defines`), and the low-level `extra_flags` array.



I ported nlohmann/json and it worked flawlessly.



GitHub: [https://github.com/deft-cli/deft](https://github.com/deft-cli/deft)



I'm looking for feedback from C++ devs.

https://redd.it/1ui7jlf
@r_cpp
r/cpp removes human made posts as written by AI

See https://www.reddit.com/r/cpp/comments/1ui5ujb/comment/oufi4x3/?screen\_view\_count=5

How am I supposed to share what I work on?

It's never nice to have what you wrote called slop, I guess people here don't realize how hurtful it can be u/STL

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