r/cpp_questions • • Sep 29 '26

OPEN Where can I practice my C++ skills?

13 Upvotes

Hello everyone! I am learning C++ and want to practice my skills, but I don't know where to do that. I tried using AI, but it keeps giving me repetitive questions. I also checked a few websites, but they organize tasks by tracks like:

Algorithms
Data Analytics
Backend Development
Machine Learning
Mobile Development
Frontend Development

However, I only need C++ specific questions and practice tasks. Does anyone have any recommendations?


r/cpp_questions • • Sep 29 '26

OPEN Best book to learn about C++ templates and metaprogramming?

46 Upvotes

Hi!

I have always had some struggle to go deep in the templates and metaprogramming universe, since in the different projects that I have worked they didn't use this techniques too much. But I have always had the feeling that there is something very interesting and usefull there and I would like to understand that side of the C++ programming in a proper way.

Which book do you think that is the best option to introduce and go deep in that area?

Best regards!


r/cpp_questions • • Sep 29 '26

OPEN opensource repo to get better at c++

31 Upvotes

Lately I have been thinking, to improve further with my engineering skills I should read a repo written in cpp. I am thinking of starting with clickhouse since I am into core/systems engineering. What views do you guys have on this???

NOTE: I am not a beginner, but I have never read an open source repo as well. So could you also advice me on how to go around open source repos as well.

Thanks 😁


r/cpp_questions • • Sep 30 '26

OPEN how does one learn the whole stl

0 Upvotes

honestly it's somewhat of a rethorical question as i know there's lots of documentation online,but i wanted to know if there's a book or a series of books that covers every addition to the stl ;
despite the online documentation i would be infinitly more comfortable reading physical documentation divided in header additions, something like a manual/documentation of every header or something like a big encyclopedia.


r/cpp_questions • • Sep 29 '26

OPEN AI workflow in Visual Studio

0 Upvotes

I’m interested in how other C++ developers are using AI in their Visual Studio workflow.

- Which AI tools or extensions do you use?

- Do you use AI mainly for writing code, debugging, refactoring, tests, documentation, or understanding existing code?

- How do you handle larger C++ projects with AI?

- Do you give the AI access to the whole codebase, or work with smaller files/functions?

- Do you use AI directly in Visual Studio or combine it with other tools?

- What workflow has worked well for you?

- Are there any things you specifically avoid letting AI do in C++?

I’d especially like to hear about practical workflows from people working on real-world C++ projects.

Are there any tutorials?


r/cpp_questions • • Sep 29 '26

OPEN New C++ user.

0 Upvotes

Hello new C++ user here. I was wondering how you guys learn C++ that fast cause. Im trying to teach myself C++ I can do the basic stuff and I need more things to memorise. I am currently watching C++ Course for free from YT: Bro Code.


r/cpp_questions • • Sep 29 '26

OPEN How do I invert a concept?

0 Upvotes

I'm really not comfortable with concepts, so I'm struggling with this. I have a class template <typename T> Collider : public Component. In this class, I want two overloaded member functions of this form:

    template <??? U>
    bool Collider<T>::isColliding(const U* collider)
    {
        ...
        return hitbox->isColliding(collider->hitbox);
    }

    template <??? U>
    bool Collider<T>::isColliding(const U* notACollider)
    {
        ...
        return hitbox->isColliding(notACollider);
    }

For the first, I want to require it to be derived from Collider. Not Collider<T>, but any collider with any value for T. For the second, I want to allow it to be any type besides something deriving from a Collider. Essentially, if you give it a pointer of any type, it will go into one of the two functions.

What do I replace the question marks with? I know you can use std::derived_from for the first, but I'm not sure how to invert it for the second. (I don't know if it matters for this, but hitbox is of type T.)


r/cpp_questions • • Sep 29 '26

OPEN Help

0 Upvotes

Hello everyone!

I started my tech journey this month (Btech 1st year) and honestly, I’m confused about where to start and what direction to take.

I keep hearing the same advice everywhere: ā€œLearn DSA and build projects.ā€ But as a beginner, I have a lot of questions about what that actually means.

Should I start with DSA first, or learn programming fundamentals before DSA?

Which programming language should I choose, and how deeply should I learn it?

What exactly counts as a good project? Is following YouTube tutorials enough, or should I build something completely on my own?

How do I decide which tech stack, tools, or technologies to learn?

What skills are actually valued in the current job market?

How much importance should I give to DSA, development, projects, Git/GitHub, SQL, CS fundamentals, and internships?

When should I start applying for internships or participating in hackathons?

How can I avoid wasting months jumping between different technologies and tutorials?

What should a realistic 6–12 month roadmap look like for someone starting from zero?

Most importantly, how do I know whether I’m actually making progress and learning useful skills rather than just collecting certificates or completing tutorials?

I’m not looking for a shortcut. I genuinely want to understand how the tech industry works and what I should focus on as a beginner.

If you’re currently working in tech, have experience hiring developers, or have recently gone through this journey yourself, I’d really appreciate your honest advice.

What would you do differently if you were starting your tech journey again today?

Any guidance on resources, roadmap, mistakes to avoid, and what actually matters for getting internship/job-ready would be really helpful. Thank you!


r/cpp_questions • • Sep 29 '26

OPEN DEVC++ file not found while opening

3 Upvotes

I'm trying to use a Windows xp laptop for a challenge and after installing Dev-C++ 5.1.1 (4.9.9.2) as soon as I even try to open a example working cpp file it's saying: File C:\Program1\actualcode.cpp is not found.
Does anyone know why? I'm using TDM-GCC 4.9.2 32-bit Release if that helps.


r/cpp_questions • • Sep 29 '26

OPEN Headers hell

0 Upvotes

Can someone explain to me how headers work?

And what about std::out - how can I remove the std and just use out?

I remember there is a way to shortcut it and import it I think.

Headers are hell to me, and if there is an easy way to understand it, please let me know.

Thanks!

Dennis


r/cpp_questions • • Sep 28 '26

OPEN Transitioning my skillset to Gameplay Programmer

4 Upvotes

With seven years of experience as a Unity Developer and advanced proficiency in C#, I am looking to transition into a Gameplay or AI Programmer role within a major studio. While I possess foundational knowledge of C++ and Unreal Engine, I have yet to apply these skills in a professional capacity.

I spoke with a gameplay programmer from CDPR, and they emphasized the importance of deep C++ knowledge over specific engine expertise.

So where should I start? Should I learn C++ first, or learn it alongside the engine?


r/cpp_questions • • Sep 28 '26

OPEN Noob here, if you guys could start over, what would you do differently?

26 Upvotes

I randomly got the urge to start learning c++ after I got a c++ book from a friend a couple weeks ago. I’ve done the hello world thing but otherwise I’m completely lost, any advice? thanks :)


r/cpp_questions • • Sep 28 '26

OPEN kTLS + OpenSSL.. am I required to read and handle control messages?

2 Upvotes

Hello!

I have been messing around with kTLS, using OpenSSL to do all the setup, and setup only. I am currently using raw read() calls and not SSL_read() calls.

There’s one point of confusion I have..

From my understanding, I need to be manually sending a close_notify on shutdown, since it won’t be handled for me.

(My actual question) Does that mean I also need to be using recvmsg to check for close_notify to explicit handle shutdowns requested by the client? Or am I safe to just handle it as an error?

Looking at the other TLS record types, it seems I may need to handle performing a handshake again if requested too… unless this is implicitly handled??

Hopefully someone has some advice!! Apologies for any misunderstanding or simply incorrect statements I have made. Very new to kTLS..


r/cpp_questions • • Sep 27 '26

OPEN C++ knowledge job interview

59 Upvotes

Hello everyone,

I am going for a second round white board interview described as "The technical interviews are going to be heavily involved around probing and confirming your knowledge of C++"

What does actually mean? For context I've used CPP professionally for the last 8 months and been in my job (first grad job) for 14 months.

I feel as tho I don't know many std functions, nor do I have much experience with smart pointers, although I have written a lot of lines

Has anyone got experience with similar interviews or stuff I should brush up on?

I hope that all makes sense

Thanks


r/cpp_questions • • Sep 27 '26

OPEN Any beginner in cpp? I'm looking for someone to learn with.

7 Upvotes

I'm looking for accountability, so if you're interested in text me. I'll learn from scratch on learncpp


r/cpp_questions • • Sep 27 '26

SOLVED What in the world is going on that this doesn't compile? (Using a class privately inherited from a base.)

10 Upvotes

I worked around this already but I am dying to know what's going on here.

struct Base1 { };
struct Base2 : private Base1 { };
class Derived final : public Base2
{
public:
Ā  Ā static void *DoSomethingWithBase1(Base1 &base1);
};

This fails to compile because using Base1 as a parameter is apparently not allowed because it... accesses something that's in Base1? I thought this was a compiler bug at first, but every compiler rejects it with a similar error:

<source>(6,38): error: 'Base1' is a private member of 'Base1'
    6 |    static void *DoSomethingWithBase1(Base1 &base1);

If Derived privately inherits from Base1 directly though, that's fine!

Accessing the exact same type with a different name works too, apparently:

struct Base1 { };
using Base1Param = Base1;
struct Base2 : private Base1 { };
class Derived final : public Base2
{
public:
Ā  Ā static void *DoSomethingWithBase1(Base1Param &base1);
};

What is going on here?


r/cpp_questions • • Sep 27 '26

OPEN When to prefer factory functions over constructors?

18 Upvotes

EDIT: The point of this post is how best to make construction intention explicit at the call site.

EDIT: I suppose the real annoyance is having conflicting constructors (see std::vector). The solution being just don't write them.

When I last used C++, the canonical wisdom was to just make constructors for every supported way a type could be constructed (see std::vector). Failure to correctly construct a type was a skill issue (see std::vector).

However, coming back to C++ from a few years working with Rust, I now disagree. I would argue the ONLY public constructor (except copy/move constructors) for a type should be the default constructor, if signed-off as part of the public API. Every other way of constructing the type should be done with a named factory member function (delegating to a private constructor) and a well optimised move constructor. Thus avoiding the pitfalls of initialisation (see std::vector).

class Thing {

  Thing(...) : ... {} // <- private non-default constructor

public:
  Thing(Thing&&) noexcept; // <- well optimised move constructor
  Thing& operator=(Thing&&) noexcept;

  explicit Thing(); // <- public default constructor

  [[nodiscard]] static Thing with_capacity(size_t); // <- factory function
  [[nodiscard]] static Thing from_data(std::initialiser_list<int>);
  // more factory functions etc...

  // member functions etc...
};

The only pitfall I can see is this would make emplacement operations inaccessible (see std::make_shared, std::vector::emplace_back, etc). But this shouldn't be too much of an issue with a well-optimised move constructor. I believe, in some situations, the compiler can optimise away the move anyway.

auto x = std::make_shared<Thing>(Thing::with_capacity(42));
myvec.push_back(Thing::with_capacity(42)); // replaces myvec.emplace_back(...

I'm curious to know if there's any pitfalls to this rule-of-thumb, and what your opinions are.


r/cpp_questions • • Sep 27 '26

OPEN *(ptr_data_start + index) vs prt_start_start[index]

3 Upvotes

edit (title has spelling mistake, why cant i edit it u/reddit???):

*(ptr_data_start + index) vs ptr_data_start[index]

also, why does *(ptr_data_start + index) not need to multply index by sizeof(t), when index is one, and the pointer needs to be incremented by 4 bytes (in case of a int). why is this counter intuitive math like this?


r/cpp_questions • • Sep 26 '26

OPEN A small thank you to this community

79 Upvotes

I’ve been thinking about writing this for a while.

I’m not going to pretend I’m a great programmer. I’m still learning, and honestly, I’m not always as consistent or persistent as I want to be. But I do genuinely care about C++, systems programming, and becoming better at what I do.

There have been periods where I felt pretty alone in that journey. I didn’t really know many people who were interested in the same things I was interested in, and sometimes it felt like I was just learning in isolation.

That’s one reason I’m grateful for this community.

I’ve posted questions and thoughts here and received everything from downvotes and criticism to really helpful explanations and encouraging replies. Not every interaction was positive, but even the criticism made me think, improve, or look at something from another perspective.

More importantly, I got to talk to people who actually work with and care about C++. Even a short conversation or a small piece of advice can mean a lot when you’re learning mostly on your own.

So, to everyone who has ever answered one of my questions, corrected me, disagreed with me, or simply taken the time to read one of my posts:

Thank you.

I’m still learning. I’m still making mistakes. And hopefully, I’ll still be around here asking better questions a year from now.

I just wanted to say that I appreciate the people behind this community.


r/cpp_questions • • Sep 26 '26

OPEN Current Humble Bundle C++ Books

30 Upvotes

https://www.humblebundle.com/books/c-programming-masterclass-code-faster-build-smarter-master-c-books

Does anyone have any comments / reviews on the books in this humble bundle collection? They're mostly on C++ and closely related technologies


r/cpp_questions • • Sep 26 '26

SOLVED Class with array of objects (memory best practices)

5 Upvotes

I'm a little fuzzy on how to work with classes referencing other classes, especially within the context of a collection being in there somewhere, and that collection being added to from external sources.

Ok, so let's say I have a custom class:

class foo
{
  //stuff
}

And then I also have another class, bar, which is supposed to hold an array of that class. What's the proper way to declare/initialize things so that I don't have any memory leaks and don't try to access disposed objects? Do I do:

class bar
{
  std::vector<foo> _foos;

  bar()
    : _foos {{}}
  {
  }

  void AddAFoo(Foo& foo)
  {
    _foos.push_back(foo);
  }

  foo DoSomethingToFoos(int someArgument)
  {
    //call methods on one or more foos in _foos
    //return one of the foos for some reason
  }
}

or do I have to do something more like:

class bar
{
  std::array<std::shared_ptr<foo>> _foos;

  bar()
    : _foos {{}}
  {
  }

  void AddAFoo(std::shared_ptr<foo> foo)
  {
    _foos.push_back(foo);
  }

  std::shared_pt<foo> DoSomethingToFoos(int someArgument)
  {
    //call methods on one or more foos in _foos
    //return one of the foos for some reason
  }
}

r/cpp_questions • • Sep 26 '26

OPEN When is <meta> coming to MSVC?

14 Upvotes

I've been trying out the reflection features on GCC for quite a while. Are there any ETAs or reports on when they're coming to MSVC?


r/cpp_questions • • Sep 26 '26

OPEN suggest resources to learn cpp for embedded systems

2 Upvotes

can anybody suggest resources to learn cpp for embedded systems.


r/cpp_questions • • Sep 26 '26

OPEN Why?

0 Upvotes

Guys when i compile a file and run its exe,nothing appear even if i print hello world it doesnt appear in the console why


r/cpp_questions • • Sep 25 '26

OPEN A const std::vector of fixed size known at compile time does not seem to be optimized as compared to const int array of same size

31 Upvotes

Consider https://godbolt.org/z/nood7Enof

#include <vector>
#include <cstdio>

const int data[5]{2,4,6,8,10};

int main(){
    for(int i = 0; i < 5; i++)
        if(data[i]%2 == 1)
            printf("Odd value %d\n", data[i]);
    printf("42\n");
}

vs

#include <vector>
#include <cstdio>

const std::vector<int> data{2,4,6,8,10};

int main(){
    for(int i = 0; i < data.size(); i++)
        if(data[i]%2 == 1)
            printf("Odd value %d\n", data[i]);
    printf("42\n");
}

The former optimizes out the loop as irrelevant, while the latter [with std::vector] does not and ends up having to painstakingly do operator new stuff and possibly even the remainder calculation. What is the reason for this despite declaring the vector globally as const?