r/Cplusplus Oct 16 '25

Welcome to r/Cplusplus!

Upvotes

This post contains content not supported on old Reddit. Click here to view the full post


r/Cplusplus 5h ago

Tutorial Sources of learning C++ for CP

Upvotes

So for ICPC prelims my mates knows c++ n all ik some diff lang basics like c, python(better) n all....so I was thinking to move into c++..also c++ seems more convenient for CP n all...so any source to get tht done..not like a very beginner course but yeah...like In 3 to 5 days for CP basics


r/Cplusplus 2d ago

Question How would you learn C++ from beginner to job-ready if you were starting today?

Upvotes

Hey everyone, I’d like to hear from people who have learned C++, how did you start and progress from beginner to more advanced C++? If you used LearnCpp, how did you go through it? Did you complete it chapter by chapter, or combine it with other resources?

I’d also really appreciate any advice about:

1. What to practice alongside LearnCpp?

2. When to start LeetCode/problem solving?

3. Beginner → intermediate → advanced project ideas?

4. Other resources worth using?

5. Common mistakes or inefficient ways of learning C++?

6. A good roadmap for becoming genuinely confident in C++?

And one final question: At what point would you consider someone proficient enough in C++ to confidently list it under the Skills section of their resume, especially when applying for internships or entry-level positions?


r/Cplusplus 1d ago

Question How bad is C++ in Optiver FPGA Intern OA??

Thumbnail
Upvotes

r/Cplusplus 1d ago

Feedback Open-source Nintendo 64 encryption app and wallet generator, needs volunteers to review code

Upvotes

I proposed and helped fund an app called retro-crypto, which is being developed under MIT license in C and C++ by a programmer called bowler-bear: https://github.com/bowler-bear/retro-crypto

It's designed to become the most secure way to message friends or store a Bitcoin stack, but it can't be recommended for more than testing yet. The design bypasses a lot of supply chain attacks by running on N64, unless the attacks come from code itself, which is why the most important thing at this stage after release is having the code analyzed. There's been a small amount of code review by one or two volunteers so far, but I'm still gathering more feedback.

"Given enough eyeballs, all bugs are shallow" -Linus's Law

I'll also mention, a different developer recently created the first known fork of the project, which I haven't tested yet: https://github.com/Linkin-Prism/retro-crypto


r/Cplusplus 3d ago

Discussion When I say its zero cost...

Thumbnail
godbolt.org
Upvotes

I mean the composition, it is truly zero cost, and if components are also zero cost we get this nice optimization done by the compiler (C++17)

This is a demo of "HAPI - The Happy API", a C++ static composition engine, pure type-level header only, MIT, library.

With proper components we managed to feed compositions directly to HLS tools (see github)

To use where the composition types are known at compile-time, compiler optimization is done by composition, type lists can store multiple compositions without loosing the types and hold the composed objects.

we can compose/describe:

drivers, peripherals, devices, protocols, buses, IO, pins, UI, Parsers...

because this types are known at compile time, and the composition is free.

c++ //my output definition OutDef< ScrollPrinter, ANSIFmt, DataParser<>, CtrlChars, ColorTrack<int>, Cursor<>, Gate, ANSIOut, #ifdef ARDUINO SerialOut, #else ConsoleOut, #endif StaticPos<20,10>, StaticArea<30,10> > out;

https://github.com/InternetOfPins/HAPI


r/Cplusplus 3d ago

Discussion jank reimagines C++ errors and gets an official native package repo

Thumbnail
jank-lang.org
Upvotes

I've never shared jank here before, but it's a Clojure dialect which is also a C++ dialect. jank compiles to C++, has seamless C++ interop, and includes a Clang-based JIT C++ compiler which enables proper Lispy REPL-driven interactive development. In this post, we see how jank's AST intertwines with Clang's AST to great effect.


r/Cplusplus 3d ago

Discussion I have made a C++ scientific calculator

Upvotes

https://youtu.be/9z3LhVxtx_o?si=lVD4CZZ9A7yEbMC2

Check this video out please like subscribe and comment


r/Cplusplus 4d ago

Question Book recom for C++

Thumbnail
Upvotes

r/Cplusplus 7d ago

Tutorial Iterating through arguments in C++26 using "template for" (Python-style)

Upvotes

Here is how you can iterate through arguments now in C++26!:

#include <print>


template <typename ...Args>
void function(const Args& ...args)
{
    template for (const auto& arg : {args...})
    {
        using ArgT = std::decay_t<decltype(arg)>;

        if constexpr (typeid(ArgT) == typeid(double))
        {
            std::println("double: {}", arg);
        }
        else if constexpr (requires { &ArgT::toString; })
        {
            std::println("has toString: {}", arg.toString());
        }
        else
        {
            std::println("other: {}", arg);
        }
    }
}


struct MyStruct
{
    int value; // initializes with 0 in C++26
    std::string toString() const
    {
        return std::format("MyStruct value is {}", value);
    }
};


int main()
{
    function(3.14, "c-string", MyStruct{});
}

It works:

double: 3.14
other: c-string
has toString: MyStruct value is 0


...Program finished with exit code 0
Press ENTER to exit console.

template for is a new feature in C++26, and I like it very much! It's my favorite C++26 feature

It looks very pythonic at this point. 😄

Let's start with args: typename ...Args and const Args& ...args work similar to def function(*args) from python - they aggregate comma separated expressions into a variadic type or variable. {args...} also works similar to python's (*myList) - it expands a "collection" into a comma separated expressions

Then goes "template for": it's a brand new loop, which expands at compile time for each iteration. Using it, you can iterate through collections with different types inside: struct fields, tuples, list literals, and custom classes with implemented tuple protocol

Checking type of argument: this line also resembles python very much: if constexpr (typeid(ArgT) == typeid(double)). Here is the python counterpart: if type(arg) is bool. There are more ways to do this check, but I think this one looks the most direct. Although you can want to use not exactly "double" type, but a convertible to it, or any floating point number type. There are standard concepts for these cases: std::convertible_to, and std::floating_point

Checking for a member: here I used an anonymous concept: if constexpr ( requires { ...;} ). Inside this concept we should put an expression that we are testing. it's a sort of python's hasattr(arg, 'toString'), but more powerful and more fragile at the same time. The expression here is taking a member reference to "toString": &ArgT::toString;. It's a better approach than testing arg.toString(), because it won't fail if "toString" isn't a constant method, or has more than 0 arguments. But it's still far from ideal, because if the object has multiply overloaded "toString" methods (what's actually a pretty realistic scenario), it will fail, and the error message will be misleading. In this case the error will be that formatter is not implemented for the "other" branch, however the actual error is in "has toString" branch. So, don't use anonymous concepts in real project, use full fledged concepts in pair with static_asserts

It's fascinating! This is still a templates metaprogramming in C++, but it looks much-much more clean than infamous std::enable_if


r/Cplusplus 6d ago

Question С-плюсеры, общий сбор

Thumbnail
Upvotes

r/Cplusplus 8d ago

Feedback For anyone who is interested in https://www.oreilly.com/library/view/sfml-game-development/9781785287343

Thumbnail
Upvotes

r/Cplusplus 8d ago

Discussion I am trying to build AgentMesh: C++20 runtime for executing agent/task DAGs

Upvotes

I've been building an open-source C++20 runtime called AgentMesh for executing multi-agent/task DAGs.

The goal is to keep high-level application code in Python while moving execution-critical infrastructure into native C++.

Current areas include:

  • DAG scheduling
  • concurrency
  • task/agent communication
  • state management
  • crash recovery
  • Pybind11 integration

I'm particularly interested in the engineering trade-offs around the Python/C++ boundary and how much work should actually live inside the native runtime.

The next major milestone is distributed execution over gRPC.

GitHub:

https://github.com/DevrG03/AgentMesh

Documentation:

https://github.com/DevrG03/AgentMesh/wiki

I'd appreciate code/architecture feedback from C++ developers.


r/Cplusplus 11d ago

Feedback From 3 seconds to 600ms — building a virtual package system for my WASM multiplayer game

Post image
Upvotes

Hi there, I'm building a multiplayer game in C++/WASM link. While testing with friends, I noticed the game took ~3s to load — 5s on slower connections. Instead of accepting it, I built my own virtual package system in C++ and cut the load time from 3s to ~600ms.

Here's the source: nodepp-filepack


Compression (packing assets):

```cpp

define NODEPP_ALLOW_THROW_EXCEPTION 0

include <nodepp/nodepp.h>

include <nodepp/zlib.h>

include <nodepp/fs.h>

include <filepack/filepack.h>

using namespace nodepp;

void onMain() {

filepack_t pack("skeld.npk");
auto x = ptr_t<ulong>(0UL, 0UL);

fs::read_folder("./assets")
.fail([](except_t err) { console::log(">>", err); })
.then([=](ptr_t<string_t> list) {
    pack.iterate_writable_stream( list, [=](string_t name, file_t stream_o ) {
        pack.get_readable_info(name).value()["compressed"] = true;
        zlib::gzip::pipe(file_t(list[x[0]], "r"), stream_o);
        x[0]++;
    });
});

} ```


Decompression (loading assets):

```cpp

define NODEPP_ALLOW_THROW_EXCEPTION 0

include <nodepp/nodepp.h>

include <nodepp/zlib.h>

include <nodepp/fs.h>

include <filepack/filepack.h>

using namespace nodepp;

void onMain() { filepack_t pack("skeld.npk"); auto stream = pack.get_readable_stream("map.png").value();

zlib::gunzip::pipe(stream, file_t("map.png", "w"));

} ```


How it works:

  • All assets are packed into a single .npk file with optional compression.
  • Assets are streamed and decompressed on the fly — nothing is loaded into memory all at once.
  • The result: faster loading, lower memory usage, and a better experience for players on slow connections.

Nodepp is open source: github.com/NodeppOfficial/nodepp


r/Cplusplus 13d ago

Question what would you say to someone that is struggling to implement linked lists in c++ even though they understand the basic concept of the data structure itself (i think my problem is with the syntax )

Upvotes

what would you say to someone that is struggling to implement linked lists in c++ even though they understand the basic concept of the data structure itself (i think my problem is with the syntax )


r/Cplusplus 13d ago

Discussion How I finally understood C++ Copy, References and Move Semantics (Real-world analogies)

Thumbnail
Upvotes

r/Cplusplus 12d ago

Question Urgent help needed!!

Thumbnail
Upvotes

r/Cplusplus 15d ago

Question Resources to learn C++ and DSA for Competitive Programming (and in general)

Upvotes

Hello everyone, I am a SWE student from India. I wanna learn C++ for competitive programming and DSA, jobs, building projects, etc as well. My reasons:

- Not only learning it for jobs, but because, C++ is very fast and has the capability of efficiently interacting with both the high level and low level systems. These are the reasons which make me learn it, especially as I am interested in how memory, RAM, GPU and other things work in the computer.

- For the sake of computer science and programming. I am interested in learning the core cs fundamentals and concepts to make myself a better software/cs engineer - to solve problems, code solutions, etc.

- I am interested in ICPC, DSA and competitive programming as well. So that would make me learn it anyways.

Honestly, I have asked and read about this question many times but I haven't got a clear and one-stop answer yet. These are the things that ppl/ai chatbots suggest me and what I read (also my reasons for not using them yet):

- USACO guide (too big)
- learncpp (good but too vast)
- the cherno's yt channel (some say they dont cover concepts in depth)
- books (too lengthy as well)

I am not looking for shortcuts, nor am I avoiding these resources because they are too big. I am ready to invest my heart and soul into learning things. But, being an engineering student, I have many other different subjects to study as well for the college. I am so much interested into AI/ML and Web dev as well.

For context, these are the things I know (i.e. I'm not starting programming from absolute 0) :

- HTML/CSS and basic JS (learning from The Odin Project but paused rn)
- basic C (learned from college and CS50x)
- Python (learned from CS50 Python course)
- SQL (learning at college + by myself)
- Java (learning at college + by myself)

The college has made the latter two subjects and C++/DSA compulsory for this year. But, I don't wanna invest that much time into studying those 2 deeply (I mean Java and SQL). I am focusing on C++/DSA, Web Dev and AI/ML as of now.

So, given my all the background and interests, could you guys please suggest me different resources to learn C++ and DSA? Also, for learning things about Competitive Programming and improving myself there.

My goal for now is to speedrun the basics of C++ (because I have already learned the basics of programming and C earlier) + learn concepts of DSA in detailed manner -> then proceed with competitive programming -> then participate in contests and along the way learn different concepts of C++ and DSA.

How is my approach? If there's any other better one, please do suggest me. Thank you!


r/Cplusplus 14d ago

Feedback Raw wayland/vulkan boilerplate library, no SwapchainKHR, modern explicit sync (syncobject, drm)

Thumbnail
Upvotes

r/Cplusplus 14d ago

Question Beginner looking for advice on what to learn next in C++

Thumbnail
Upvotes

r/Cplusplus 15d ago

Tutorial C++26 Contracts: What Do They Add Beyond Manual Checks and Assertions?

Thumbnail
techfortalk.co.uk
Upvotes

r/Cplusplus 16d ago

Discussion Implementing arbitary-precision square rooting algorithm using the long division in C++ (with custom BigNumber library)

Upvotes

Hello everyone,

Some days ago, I have finished building an algorithm in C++ using only my mobile phone (Termux and Helix), and I want to show it to you!

So, it uses the long division method. Why not the Newton-Rasolph method or use the GMP library? Because this program was built for two reasons:

  1. An educational purpose of learning how to build an algorithm I have an idea of and optimize it as much as I can.

  2. To learn how to implement a mathematical algorithm as a program, and to also learn more about C++.

The performance of this algorithm is following the O(n²), but with a small constant, since I have optimized this algorithm as much as I can. You can see the benchmark in the GitHub link down below. Here is how I optimized it:

This algorithm has a custom BigNumber class that makes a number as a vector, each digit is represented as an element in the vector, and, each digit follows a base 1017 number instead of a decimal digit! This is the underlying logic behind very famous libraries like BigInt, but since these libraries are so general (they have to deal with very large multiplications, division, negatives and many general cases). This class recognized that the max number is being multiplied to the number is 100 (see the long division method) and implemented base 1017. Therefore, since 100<1017 (the base), then the multiplication is just multiplying one digit by the number. You can check the code for more

The way the algorithm predicts the digit is the binary search, it checks a number, and then eliminates half of the domain of search. This way, it is faster by 50-60% than the ordinary linear search.

And more! You can check the README of the project in this repo:

https://github.com/hasan-mazen-darwish/algorithm-square-rooter

I spent more time on this REAMDE than the actual code, so I hope you don't get lost 😅

I'm open for any discussion or any question! Feel free to ask anything or criticize this project or a specific line of code!


r/Cplusplus 16d ago

Question Please help

Upvotes

Im a newbie btw and i need some help fixing this without giving my soul to an AI company


r/Cplusplus 18d ago

News Speak at code::dive 2026 📣

Post image
Upvotes

r/Cplusplus 20d ago

Feedback Low latency c++

Upvotes

I want to learn the ins and outs of low latency c++, so far I have read tour of c++, started reading concurrency in c++ (about 3 chaps done) and done a lot of competitive programming (is this irrelevant?). In your experience, is this the right way of approaching the subject? Is there a different better way? Any advise is much appreciated.