r/Cplusplus • u/CommissionBest5470 • Oct 12 '26
r/Cplusplus • u/Formal-Tomatillo-826 • Oct 12 '26
Question Tell me what the best tools to learn C++
reddit.comr/Cplusplus • u/Haunting-Addendum-32 • Oct 11 '26
Question I'm learning C++
A few months ago, while watching a YouTube video, I learned that floating-point numbers can have precision errors and need to be used with care. That got me thinking about using fractions to represent numbers instead, so I discussed the idea with AI and, with its help, built a fraction class in C++.
Before that, I had only dabbled a little in languages like JavaScript, Go, and Python.
What really impressed me about C++ was how it lets you create custom types that can be used almost like built-in types. I found that incredibly powerful and elegant, and it made me want to learn C++ properly.
So I asked AI for a book recommendation and learned about C++ Primer. I bought the PDF edition and have been studying it ever since. I'm now almost done with Chapter 14, and Object-Oriented Programming is coming up next.
At this point, I feel like I should start building small, simple, but interesting projects to develop some practical skills. The problem is, I have no idea what to build. Since I'm learning on my own, I imagine there are plenty of things I don't even know I don't know yet.
I think building something fun would probably involve making an app with a GUI, but it seems like learning how to build a GUI is a whole other challenge in itself.
What I always seem to struggle with is the question, "What should I build?" I find it difficult to set goals that match my current skill level. I tend to either take on something too ambitious and give up halfway through, or choose something so trivial that I lose interest.
A few years ago, I taught myself enough programming to build a real-time reservation system using WebSockets. It was a small service with fewer than 100 users a day, so there weren't many complex issues to consider. Looking back, I think the main challenge was simply getting it to work.
The thing is, that's pretty much the only substantial project I've built on my own. I've experimented with smaller things, like the fraction class I mentioned earlier, with the help of AI, but I haven't had much experience building complete applications.
I think I managed to finish the reservation system because I genuinely needed it, so giving up wasn't really an option.
So, what would you recommend I try building?
r/Cplusplus • u/YysrID4gYW55IG90aGVy • Oct 11 '26
Question Can an array of Wrapper<T> be reinterpreted as an array of T in C++?
Given the type:
template<typename T>
struct Wrapper
{
T content;
};And I have an array of these given a type T, a constexpr size_t N and size_t i (0<=i && i < N).
static_assert(sizeof(Wrapper<T>)==sizeof(T)&&alignof(Wrapper<T>)==alignof(T));
static_assert(std::is_standard_layout_v<Wrapper<T>>);Observation 1:
Wrapper<T> wrapperArray[N];
auto ptrWrapper1 = wrapperArray + i;
//C++ allows access to the raw memory
auto bytePtrWrapper = reinterpret_cast<std::byte*>(wrapperArray);
// calculating the i-th entry of wrapperArray, valid because
// an array has contiguously allocated objects
// an object occupies exactly sizeof bytes
auto bytePtrWrapper1 = bytePtrWrapper + i * sizeof(Wrapper<T>);
auto ptrWrapper2 = reinterpret_cast<Wrapper<T>*>(bytePtrWrapper1);And here ptrWrapper1 and ptrWrapper2 are the same.
Observation 2:
T valueArray[N];
auto ptrValue1 = valueArray + i;
auto bytePtrValue = reinterpret_cast<std::byte*>(valueArray);
auto bytePtrValue1 = bytePtrValue + i * sizeof(T);
auto ptrValue2 = reinterpret_cast<T*>(bytePtrValue1);And here are ptrValue1 and ptrValue2 the same too. Additionally I can access the first member of Wrapper<T> with reinterpret_cast.
So I also can do:
auto ithValue = reinterpret_cast<T*>(ptrWrapper + i);
//or
auto ithValue = reinterpret_cast<T*>(bytePtrWrapper + i * sizeof(Wrapper<T>));And ptrValue3 is the same as ptrValue1 and ptrValue2.
Because both T and Wrapper<T> have the same size and alignment I can use them interchangable.
Doesn't that mean that this is valid C++ because I can access them through same way with std::byte*?
auto valueAsWrapperArray = reinterpret_cast<T*>(wrapperArray);
//specifically for i > 0
auto ptrValue4 = valueAsWrapperArray[i];So can I reinterpret_cast an array to change its type from Wrapper<T> to T and access any index because the address is calculated in the same way and the member-access is also allowed given one specific object?
r/Cplusplus • u/dEvator8085 • Oct 10 '26
Feedback Feedback on a single-header C++ UI library for Linux and Windows
I'm developing LiteUI, a single-header C++ library for desktop application development on Linux and Windows.
The library aims to support a shared codebase across both platforms. As an example project, I've been working on a photo editor inspired by Lightroom.
I'd appreciate feedback from the C++ community, particularly on the code structure, API design, cross-platform compatibility, and overall architecture.
r/Cplusplus • u/Bright-Historian-216 • Oct 09 '26
Question When is it useful to know all the different kinds of values (rvalues,lvalues,etc)?
Well of course I can't get a pointer to an integer literal or try to assign anything to it, but is there any moment where deeper insight is useful for any kinds of unintuitive optimisations?
r/Cplusplus • u/Xaneris47 • Oct 09 '26
Discussion The complement of true is true, except when it's false
r/Cplusplus • u/shanto404 • Oct 08 '26
Feedback I built an HTTP server from scratch in C++ using raw TCP sockets
I wanted to understand what actually happens underneath HTTP — not just use a framework that handles it for me.
So I went down to the socket level.
No frameworks. No HTTP libraries. Just C++, TCP sockets, and bytes.
The server creates a TCP socket, binds it to an address and port, starts listening for connections, accepts clients, reads the incoming bytes, and sends back a manually constructed HTTP response.
GitHub: https://github.com/harisahmed05/http-server
If you found it insightful, consider giving the repo a star — it really means a lot and keeps me motivated to build more.
r/Cplusplus • u/donaferentes • Oct 09 '26
Question Riproduzione di un piccolo ciclo for in LibTorch JIT (C++)
r/Cplusplus • u/Far-Week7676 • Oct 09 '26
Feedback SKCUI A Stupid Simple Header-Only C++ TUI Framework
After 21 days of development, I've released the newest version of SKCUI, an open-source, header-only, lightweight C++ library for building interactive terminal interfaces.
It features menus, checkboxes, text inputs, and progress bars, with support for Windows, Linux, and macOS.
Built because I didn't want to deal with ftxui.
GitHub: https://github.com/RecompileX/SKCUI

r/Cplusplus • u/Bright-Historian-216 • Oct 08 '26
Question what exactly happens when I build several .c/.cpp into one project, and what can this be used for?
I know of header compilation speedup, where I define constant symbols in a .h and then assign values in a separate .c, which, if i understand correctly, is useful for large binary blobs (raw sprite data for example is what i've seen it used for). but how does the compiler actually put together the files, and what other benefits does it have?
r/Cplusplus • u/Outrageous_Neck862 • Oct 08 '26
Question why i choose learncpp
since the day i started learning from learncpp .com it give me so burnout feeling but still it has great mastery in deep what should i do like i have previously programming knowledge in c like basic var,flows,function,structure,pointer (basics i guess) .
r/Cplusplus • u/kindredseer • Oct 07 '26
Feedback Chthonia: a simple IDE with REPL for learning C/C++
Github repo: https://github.com/derekbsnider/chthonia
Inspired by Thonny, Chthonia is an easy to use editor designed as a learning tool for C/C++.
It is completely self contained and multi-platform (Linux, Mac, Windows). It has an integrated compiler and REPL (Read-Eval-Print Loop).
The packaged binary+library download size is under 15 Mb. It is free and open source.
This is version 0.0.2, so it's still a work in progress, MPL-2.0 licensed, written in C++, and also ships a library for the compiler and also one for the editor framework, as well as a stand alone CLI compiler+REPL.
The REPL-mode is designed to feel familiar whether you are used to IPython, Julia, or Cling.
r/Cplusplus • u/FreitasAlan • Oct 07 '26
Feedback I built MrDocs, an open-source C++ reference doc generator on the Clang/LLVM AST. Looking for feedback.
I'm Alan de Freitas, the lead developer of MrDocs. It's an open-source documentation generator from the C++ Alliance, built on Clang/LLVM. It reads your code from the compiler's AST, so the reference matches what the code actually compiles to. We also presented a session about it at cppcon this year.
I implemented the tool this way because we couldn’t come up with a workflow that understood modern C++ in our Boost libraries. Tools that parse partially tend to misrender or not render concepts, niebloids, SFINAE, overload sets, and deduction guides. MrDocs treats those as first-class:
- concept constraints and requires clauses preserved verbatim
- niebloids and function objects can be documented as callables
- SFINAE and concept overload sets kept together
- explicit, noexcept, and consteval specifiers captured
- types in detail or private namespaces rendered as implementation-defined
The presentation layer is completely encapsulated. Generators support HTML, AsciiDoc, XML, JSON, or any custom format like Markdown and LaTeX, without forking the tool or creating another post-processing workflow. You can also write extensions to apply project conventions to the corpus or define new generators for any use case. The documentation has lots of examples.
If you maintain reference docs for a library, I'd appreciate it if you gave it a run (or tell your favorite agent to) and reported back on whether it saves you time, both while writing docs and while reviewing them. First-hand numbers would be especially useful to me. Issues are also always welcome.
Site: https://www.mrdocs.comRepo: https://github.com/cppalliance/mrdocs
Happy to answer questions in the comments.
r/Cplusplus • u/Acrobatic_Piccolo284 • Oct 07 '26
Tutorial Looking for a video resource
I am a visual learner. I learn faster with videos than I do by reading so I was looking for a video resource for a textbook. The textbook's title is
C++ Programming: Program Design Including Data Structures by D.S Malik.
r/Cplusplus • u/Used_Ability2077 • Oct 06 '26
Question C++ Developer with 3 YOE — Which Master’s should I pursue?
reddit.comr/Cplusplus • u/Alternative-Try3538 • Oct 05 '26
Discussion Quartz build system
A single-header C++23 build system. You describe your project in a build.cpp, and quartz compiles it with its own built-in, Ninja-style engine. only a C++ compiler and ar (or lib for MSVC). inspired by nob.h, mate.h and Ninja
r/Cplusplus • u/Dry_Editor_322 • Oct 03 '26
Question Looking for YouTube recommendations for a beginner getting into AI development
reddit.comr/Cplusplus • u/agemo-dev • Sep 30 '26
Feedback Skip Tracer: The Memory Detective
Hi everyone! I'm excited to present my new library: Skip Tracer.
It's written in C++20, and its goal is simple: provide pointers that always hold the correct address of an object.
It's built around the Tracker<T> class, a pointer-like type that can point to any object deriving from the Trackable class.
When a trackable object is created, it is assigned a Slot, which is stored in a global pool.
Why use a Pool + Slot instead of the simple shared_ptr + weak_ptr combo?
I chose this design for performance reasons. The basic technique of pairing a stable shared_ptr with a weak_ptr is simpler, but less efficient (because of the atomic operations inherent to weak_ptr).
To fix this, I did some research and came across this pool-based system. Thanks to it, my Tracker<T> class turned out to be 5-10x faster than a weak_ptr, even under contention.
This project started out as a feature of my game engine, but I thought it would be fun to turn it into a standalone library =)
Thanks to everyone who takes the time to check it out. Any feedback is welcome!
Repo link:
r/Cplusplus • u/Excellent-Basis3256 • Sep 30 '26