TGViewer
Channel Public Channel
C++ - Reddit

C++ - Reddit

@r_cpp

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
Subscribers
229
Photos
48
Videos
8
Links
25.5K

Showing posts older than #24282 · Back to latest

Older Posts 20 shown
Post #24281 16
Post #24280 21
Post #24278 20
Evidence of overcomplication

https://www.youtube.com/watch?v=q7OmdusczC8

I just finished watching this video and found it very helpful, however, when watching, I couldn’t help thinking that the existence of this talk this is a prime example of how the language has gotten overly complicated. It takes language expertise and even then, requires a tool like compiler explorer to confirm what really happens.

Don’t get me wrong, compile time computation is extremely useful, but there has to be a way to make the language/design easier to reason about. This could just be a symptom of having to be backwards compatible and only support “bolting” on capability.

I’ve been an engineer and avid C++ developer for decades and love the new features, but it seems like there is just so much to keep in my headspace to take advantage everything modern C++ has to offer. I would like to save that headspace for the actual problems I am using C++ to solve.



https://redd.it/1ozsmto
@r_cpp
YouTube consteval All The Things? - Jason Turner - ACCU 2025 ACCU Membership: https://tinyurl.com/ydnfkcyn --- consteval All The Things? - Jason Turner - ACCU 2025 --- consteval: a powerful tool from C++20 that forces the compiler to evaluate code at compile time. What what can, or even should, be forced to compile…
Post #24277 15
I love Competitive Programming (and Cpp) but I hate Programming

I am currently finishing high school and am facing a decision regarding my university major at ETH (Zurich). Up until recently, I was planning to pursue Mechanical Engineering, but my recent deep dive into Competitive Programming has made me seriously consider switching to Computer Science. Is this a valid thought??

My conflict:

What I Love:
My passion for coding comes entirely from the thrill of algorithmic problem-solving, the search for intelligent solutions, and the mathematical/logical challenges. The CP experience is what I like.

What I Dislike:

Dont get me wrong, I don't have much experience with programming (except CP)
I find many common programming tasks unappealing. Like building front-ends, working with APIs, or dealing with the syntax of new languages/learning new languages. These feel less like engaging problem-solving and more like learning a "language" or tool. (which is exactly what it is)

My fear:

I am concerned that my current view of "programming" is too narrow and that my love is purely for the niche, theoretical, and mathematical side of CS (algorithms and complexity), and not for "real-world" software development (building and maintaining applications).

My Question:

\- Does a Computer Science degree offer enough focus on the theoretical and algorithmic side to sustain my interest?

\- Is computer science even an option for me if I don't like learning new languages and building websites?

\- Should I stick with Mechanical Engineering and keep CP as a hobby?


Thanks in advance, Luckily I still got plenty of time deciding since I have to go to the military first :(

https://redd.it/1ozr3l7
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
Post #24276 17
Post #24275 17
New C++ Conference Videos Released This Month - November 2025 (Updated To Include Videos Released 2025-11-03 - 2025-11-16)

**CppCon**

* Concept-based Generic Programming - Bjarne Stroustrup - [https://youtu.be/VMGB75hsDQo](https://youtu.be/VMGB75hsDQo)

**C++Now**

2025-11-10 - 2025-11-16

* Growing Your Toolkit From Refactoring to Automated Migrations - Matt Kulukundis - [https://youtu.be/vqFEKvI0GmU](https://youtu.be/vqFEKvI0GmU)
* C++ as a Microscope Into Hardware - Linus Boehm - [https://youtu.be/KFe6LCcDjL8](https://youtu.be/KFe6LCcDjL8)
* Introduction to C++ Function Template Partial Ordering - Matheus Izvekov - [https://youtu.be/yY2qiL2oI2Y](https://youtu.be/yY2qiL2oI2Y)

2025-11-03 - 2025-11-09

* Techniques for Declarative Programming in C++ - Richard Powell - [https://youtu.be/zyz0IUc5po4](https://youtu.be/zyz0IUc5po4)
* C++ Generic Programming Considered Harmful? - Jeff Garland - [https://youtu.be/jXQ6WtYmfZw](https://youtu.be/jXQ6WtYmfZw)
* Coinductive Types in C++ Senders - Building Streams out of Hot Air - Steve Downey - [https://youtu.be/POXB5xRai74](https://youtu.be/POXB5xRai74)

2025-10-27 - 2025-11-02

* Overengineering max(a, b) - Mixed Comparison Functions, Common References, and Rust's Lifetime Annotations - Jonathan Müller - [https://youtu.be/o2pNg7noCeQ](https://youtu.be/o2pNg7noCeQ)
* The Sender/Receiver Framework in C++ - Getting the Lazy Task Done - Dietmar Kühl - [https://youtu.be/gAnvppqvJw0](https://youtu.be/gAnvppqvJw0)
* Effective CTest - a Random Selection of C++ Best Practices - Daniel Pfeifer - [https://youtu.be/whaPQ5BU2y8](https://youtu.be/whaPQ5BU2y8)

**C++ on Sea**

2025-11-10 - 2025-11-16

* Lightning Talk: Conan Strikes Back - Easy Migration to Conan 2.0 - Evgenii Seliverstov - [https://youtu.be/hHXLWyZi9IQ](https://youtu.be/hHXLWyZi9IQ)
* Lightning Talk: GPU Programming with C++ and Triton - Gil Hoben - [https://youtu.be/TwsFpZH8T2M](https://youtu.be/TwsFpZH8T2M)
* Lightning Talk: A Recipe for Designing Your Work Week as a Software Engineer - Sandor DARGO - [https://youtu.be/5oby3fGLBLE](https://youtu.be/5oby3fGLBLE)

2025-11-03 - 2025-11-09

* What C++ Needs to be Safe - John Lakos - [https://youtu.be/3eqhtK3hV9A](https://youtu.be/3eqhtK3hV9A)
* Why Technical Engineering Interviews Are Broken and How to Actually Make Them Better - Kristen Shaker - [https://youtu.be/WKVH0Lexw\_U](https://youtu.be/WKVH0Lexw_U)
* Lightning Talk: Start a User Group, in 5 Easy\* Steps - Robert Schimkowitsch - [https://youtu.be/WkBJ79uZupo](https://youtu.be/WkBJ79uZupo)

2025-10-27 - 2025-11-02

* std::generator in C++23: When to use, and how to improve it - Johannes Kalmbach - [https://youtu.be/l9qKGGgnZYg](https://youtu.be/l9qKGGgnZYg)
* C++, C#, Rust or Python - Which is the Best Choice for Low Energy Consumption? - [https://youtu.be/DYu1NpuduWI](https://youtu.be/DYu1NpuduWI)
* Teaching an Old Dog New Tricks - A Tale of Two Emulators - Matt Godbolt - [https://youtu.be/gg4pLJNCV9I](https://youtu.be/gg4pLJNCV9I)

**ACCU Conference**

2025-11-10 - 2025-11-16

* consteval All The Things? - Jason Turner - [https://youtu.be/q7OmdusczC8](https://youtu.be/q7OmdusczC8)
* The Past, Present and Future of Programming Languages - Kevlin Henney - [https://youtu.be/8-3QwoAmyuk](https://youtu.be/8-3QwoAmyuk)
* The Definitive Guide to Functional Programming in Cpp - Jonathan Müller - [https://youtu.be/lvlXgSK03D4](https://youtu.be/lvlXgSK03D4)

2025-11-03 - 2025-11-09

* What Makes Modern C++ Compelling For Programmers? - Gareth Lloyd - ACCU York Meetup - [https://youtu.be/nmQ0wbdY1ZU](https://youtu.be/nmQ0wbdY1ZU)
* How To Write a Rubik’s Cube Solver - Sam Saariste - [https://youtu.be/oNk5vm3jroQ](https://youtu.be/oNk5vm3jroQ)
* Optimising Data Building In Game Development - Dominik Grabiec - [https://youtu.be/KNAyUjeNewc](https://youtu.be/KNAyUjeNewc)
* Deliver Better Technical Presentations - Challenges Faced by Technical Speakers - Jack Simms - [https://youtu.be/p\_B7iPCoUgg](https://youtu.be/p_B7iPCoUgg)

2025-10-27 - 2025-11-02

* New (and Old) C++ Standard Library Containers - How to Choose the Right
YouTube Concept-based Generic Programming - Bjarne Stroustrup - CppCon 2025 https://cppcon.org/ --- Concept-based Generic Programming - Bjarne Stroustrup - CppCon 2025 https://github.com/CppCon/CppCon2025 This talk presents programming techniques to illustrate the facilities and principles of C++ generic programming using concepts.…
Post #24274 15
Should I switch to Bazel?

It is quite apparent to me that the future of any software will involve multiple languages and multiple build systems.

One approach to this is to compile each dependency as a package with its own build system and manage everything with a package manager.

But honestly I do not know how to manage this, even just pure C/C++ project management with conan is quite painful. When cargo comes in everything becomes a mess.

I want to be productive and flexible when building software, could switching to Bazel help me out?

https://redd.it/1ozkhe3
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
Post #24273 19
KFR 7: major DSP update, new audio I/O, elliptic filters, and performance improvements

KFR, an open-source C++ DSP library, has reached version 7 with new DSP algorithms, wider platform support, and performance gains.

Key additions:

Elliptic IIR filter design and zero-phase IIR filtering via `filtfilt`.
Reworked audio reading/writing with support for WAV, W64, RF64/BW64, AIFF, FLAC, CAF, ALAC, MP3, and raw formats.
New high-level Audio module aimed at multichannel processing.
Initial RISC-V SIMD support.
Requires C++20.

KFR capabilities:

IIR and FIR filter design and processing.
DFT, including multidimensional transforms.
Sample-rate conversion using a polyphase filter based on a Kaiser window.
Matrix transpose and other matrix/tensor operations.
SIMD-optimized math and DSP functions.

KFR focuses on performance through extensive vectorization (SSE, AVX, NEON, RVV) with optional runtime dispatch.

GitHub: https://github.com/kfrlib/kfr
Docs: https://kfr.dev/docs/latest/
License: GPLv2+ (see the site for other licensing options).

New benchmark results from the LIGO, Virgo, and KAGRA collaborations are available, comparing KFR's performance against FFTW for signal processing in gravitational-wave research: https://ar5iv.labs.arxiv.org/html/2503.14292

https://redd.it/1ozhd60
@r_cpp
GitHub GitHub - kfrlib/kfr: Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM… Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON, RISC-V RVV) - kfrlib/kfr
Post #24271 18
Latest Visual Studio 2026 with cmake 4 breaks my cmake install script

In older builds of VS 2026 Insiders the below install lines in CMakeLists.txt worked, I think the version of cmake was still v3.xx at that time. But I have just installed the newly released stable edtion of VS 2026 with cmake 4.1.1 and the install commands below no longer work

# Install the executable into bin/
install(TARGETS ${PROJECTNAME} RUNTIME DESTINATION bin)

# Install the fonts folder into bin/
install(
DIRECTORY ${CMAKE
SOURCEDIR}/fonts
DESTINATION bin
)


I get these errors (when I select Install from VS menu):

[0/1] Install the project...
-- Install configuration: "Debug"
CMake Error at cmake
install.cmake:41 (file):
file cannot create directory: C:/Program Files
(x86)/imgui-sfml-cmake-4300-2/bin. Maybe need administrative privileges.

FAILED: CMakeFiles/install.util
C:\WINDOWS\system32\cmd.exe /C "cd /D C:\src\cpp\imgui-sfml-cmake-4300-2\out\build\x64-Debug && "C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -P cmakeinstall.cmake"
ninja: build stopped: subcommand failed.

Has the syntax changed for the cmake install function? Why is it trying to install in C:/Program Files? In cmake 3.xx it would install into <project\
name>\\out\\install\\x64-Debug\\bin.


https://redd.it/1ozac8n
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
Post #24270 13
server->post(base_path + "/stores/:id/seats", store_router.add_seat);
server->put(base_path + "/stores/:id/seats/:seatId", store_router.update_seat);
server->del(base_path + "/stores/:id/seats/:seatId", store_router.delete_seat);
server->get(base_path + "/stores/:id/seats/availability", store_router.check_seat_availability);

// ========================================
// PRODUCT & CATEGORY ROUTES
// ========================================
// Products
server->get(base_path + "/stores/:storeId/products", product_router.list);
server->get(base_path + "/stores/:storeId/products/:id", product_router.get_by_id);
server->post(base_path + "/stores/:storeId/products", product_router.create);
server->put(base_path + "/stores/:storeId/products/:id", product_router.update);
server->del(base_path + "/stores/:storeId/products/:id", product_router.remove);
server->put(base_path + "/stores/:storeId/products/:id/stock", product_router.update_stock);

// Product categories
server->post(base_path + "/stores/:storeId/products/:id/categories", product_router.add_category);
server->del(base_path + "/stores/:storeId/products/:id/categories/:categoryId", product_router.remove_category);

// Categories
server->get(base_path + "/categories", category_router.list);
server->get(base_path + "/categories/:id", category_router.get_by_id);
server->post(base_path + "/categories", category_router.create);
server->put(base_path + "/categories/:id", category_router.update);
server->del(base_path + "/categories/:id", category_router.remove);

// ========================================
// ORDER ROUTES
// ========================================
// Order management
server->get(base_path + "/orders", order_router.list);
server->get(base_path + "/stores/:storeId/orders", order_router.list_store_orders);
server->get(base_path + "/orders/:id", order_router.get_by_id);
server->post(base_path + "/orders", order_router.create);
server->put(base_path + "/orders/:id", order_router.update);
server->put(base_path + "/orders/:id/cancel", order_router.cancel);
server->put(base_path + "/orders/:id/confirm", order_router.confirm);
server->put(base_path + "/orders/:id/status", order_router.update_status);
server->put(base_path + "/orders/:id/complete", order_router.complete);

https://redd.it/1oz9lpt
@r_cpp
Reddit From the cpp community on Reddit: Am I using C++ the wrong way by making it feel TypeScript-like? Explore this post and more from the cpp community
Post #24269 11
Am I using C++ the wrong way by making it feel TypeScript-like?

I’ve liked C++ since around 2014. I love that it’s compiled, object-oriented, doesn’t have garbage collection, and has clean, well-structured syntax.
But even though I’ve liked it for a long time, I never managed to get a job using it. I was still a newbie, and nobody really hires beginners in C++. So for work I moved to Node.js and PHP. I also enjoy JavaScript because it still feels somewhat similar to C-style languages.

Now, I finally have the freedom to choose my own tech stack again. I want to return to C++, but I’m having a hard time finding a simple, beginner-friendly C++ web framework. The closest thing that works for me is Boost.Beast, but it still feels very low-level.

Because of that, I ended up building my own small wrapper and started writing C++ in a more “TypeScript-ish” style. Now I’m wondering if I’m doing something wrong. Should I not shape C++ like that?

I’d appreciate any opinions or advice from you all.

Screenshot of my TypeScript-style C++ code: [https://imgur.com/a/MjxrzSJ](https://imgur.com/a/MjxrzSJ)
in case the imgur link down:

// ========================================
// AUTHENTICATION ROUTES
// ========================================
server->post(base_path + "/auth/register", auth_router.register_user);
server->post(base_path + "/auth/login", auth_router.login);
server->post(base_path + "/auth/logout", auth_router.logout);
server->get(base_path + "/auth/me", auth_router.get_current_user);
server->post(base_path + "/auth/refresh", auth_router.refresh_token);
server->post(base_path + "/auth/verify-email", auth_router.verify_email);
server->post(base_path + "/auth/forgot-password", auth_router.forgot_password);
server->post(base_path + "/auth/reset-password", auth_router.reset_password);
server->post(base_path + "/auth/change-password", auth_router.change_password);

// ========================================
// USER ROUTES
// ========================================
server->get(base_path + "/users", user_router.list);
server->post(base_path + "/users", user_router.create);
server->put(base_path + "/users/:id", user_router.update);

// ========================================
// STORE ROUTES
// ========================================
// Store management
server->get(base_path + "/stores", store_router.list);
server->get(base_path + "/stores/:id", store_router.get_by_id);
server->post(base_path + "/stores", store_router.create);
server->put(base_path + "/stores/:id", store_router.update);
server->del(base_path + "/stores/:id", store_router.remove);
server->put(base_path + "/stores/:id/owner", store_router.transfer_ownership);

// Store managers
server->get(base_path + "/stores/:id/managers", store_router.list_managers);
server->post(base_path + "/stores/:id/managers", store_router.add_manager);
server->del(base_path + "/stores/:id/managers/:userId", store_router.remove_manager);

// Store locations
server->get(base_path + "/stores/:id/locations", store_router.list_locations);
server->post(base_path + "/stores/:id/locations", store_router.add_location);
server->put(base_path + "/stores/:id/locations/:locationId", store_router.update_location);
server->del(base_path + "/stores/:id/locations/:locationId", store_router.delete_location);

// Working hours
server->get(base_path + "/stores/:id/working-hours", store_router.get_working_hours);
server->put(base_path + "/stores/:id/working-hours", store_router.update_working_hours);

// Store seats
server->get(base_path + "/stores/:id/seats", store_router.list_seats);
Post #24265 16
Post #24262 19
a few more `<bit>` functions such as `std::bit_reverse` or `std::bit_compress`.
It was already in LWG prior to Kona, but SG6 Numerics needed to double-check that
the numbers make sense and whatnot.
It looks like they do.


##### [P3772R0](https://isocpp.org/files/papers/P3772R0.html) `std::simd` overloads for bit permutations

This just adds the corresponding `std::simd` overloads to do everything in P3014 in parallel.
Almost every other function in `<bit>` already has a SIMD overload,
so this is just a consistency fix.

##### [P3724R1](https://isocpp.org/files/papers/P3724R1.html) Integer division

This adds a bunch of functions for performing integer division with rounding modes
other than truncation/towards zero, which the builtin `/` operator does.
SG6 Numerics overall liked the idea,
but the proposal went a bit overboard with the amount of rounding modes added.

I'm yoinking `std::div_to_odd` and `std::div_to_even` out of the next revision.
Neither me nor anyone in the room was able to think of a use case for these.

##### [P3793R0](https://isocpp.org/files/papers/P3793R0.html) Better shifting

This adds two functions `std::shl` and `std::shr`,
which allow you to perform overlong shifts without undefined behavior.
The builtin `<<` operator has UB for "overlong" and negative shifts,
i.e. `int32_t(1) << 32` and `1 << -1` are UB.
Both of these problems are addressed by the "safer" new functions.

However, there was a lot of discussion around how to handle negative shifts.
The paper currently turns this into an implementation-defined result + erroneous behavior,
but about half the room wanted the "mathematically correct" behavior of shifting in the opposite direction in negative inputs.

The next revision should do that.
In hindsight, I realized that "safety by default" is probably a good feature,
and what's currently proposed is a half-measure.
While there is a cost to checking for negative inputs,
you can get the fast behavior like `std::shl(x, std::to_unsigned(s))`,
where `std::to_unsigned` comes from P3643R2.
You can also just `static_cast`, obviously.

In any case, shifting in the opposite direction seems like the best approach to me now;
it just needs a bit of confidence, some benchmarks, etc. to convince LEWG of that.

##### [P3735R0](https://isocpp.org/files/papers/P3735R0.html) `partial_sort_n`, `nth_element_n`

This paper made it past SG9 Ranges,
and the idea was overall well-received.
With the new algorithms, you would be able to write

int elems[] {3, 1, 2};
std::ranges::partial_sort_n(elems, 10); // now {1, 2, 3}

Notably, even if the provided size exceeds the size of the range,
you don't get UB.
By comparison, attempting to "get lowest 10 elements with `std::partial_sort`" is dangerous:

std::ranges::partial_sort(elems, elems + 10); // UB in pointer arithmetic

I've seen this bug happen often enough for me to make a proposal.

The only issue is that SG9 didn't like the name (`_n` suffixes usually mean something else in `<algorithm>`,
so it's getting renamed to `partial_sort_at_most`.

https://redd.it/1oyltrq
@r_cpp
Older posts →
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →