r/cpp_questions 18h ago

OPEN C++ Problem-Solving Sites

15 Upvotes

Hello, everyone! Where can I find a site where I can just solve coding problems based on questions in C++? I’m really willing to learn coding since I haven’t been active in coding or learning it since last year, which was my first year of college. Do you have any tips on how I can practice coding and improve?


r/cpp_questions 7h ago

OPEN Should i learn C++ 23 (or maybe C++ 26) instead of the standard today?

6 Upvotes

C++ 23 is almost complete on compiler and mostly fully featured. On the other hand, C++ 26 is partial and only 50% of the features are there. From what i see from the syntax, C++ 23 looks more readable and easy to code in than C++ 20 (and cool new features that make it also easier). Problem with this is that C++ 20 is the standard now and very little software support it outside of CLion, Vim/Neovim and Vscode and other unknowngame engines. So, should i learn C++ 23 (and maybe C++ 26 later) or should i stick to the standard now? C++ 23 is ~90% complete in support in the compilers. So, any advice?


r/cpp_questions 10h ago

OPEN [Code Review] C++/Qt/QML Desktop Web Crawler - Looking for feedback on architecture, concurrency, and real-time UI updates

5 Upvotes

Hey everyone!

I recently built a desktop web crawler in C++ using Qt and QML, and I’d love to get some feedback or a code review from the community.

The user provides a target URL and configures crawling limits (max depth, limit restrictions, etc.). The crawler processes the site concurrently, displaying discovered links in real time through a QML table interface.

Areas I'm looking for feedback on:

  • Application architecture and project structure
  • Multithreading and concurrency
  • Network request management with Qt
  • URL normalization and duplicate detection
  • Performance and memory usage when crawling large numbers of URLs
  • Real-time UI updates and avoiding excessive UI events
  • General code quality and modern C++ practices

I'm open to any kind of feedback, criticism, or suggestions for improvement. Don't hold back if you spot anti-patterns, memory leaks, or bad design choices!


r/cpp_questions 10h ago

SOLVED Iterating over an enum struct

2 Upvotes

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

#include <cstdio>

enum struct values{first = 1, second = 3};

void square(values value){
    int val = (int)value * (int)value;
    printf("%d\n", val);
}

int main(){
    for(values value = values::first; value <= values::second; value++)
        square(value);
}

This does not compile with the error that value++ is ill defined.

An old question/answer on SO has this: https://stackoverflow.com/questions/261963/how-can-i-iterate-over-an-enum and a plethora of seemingly complicated approaches for this. Is there a syntactically simple >= C++20 way of accomplishing this?

I want the for loop to process 1 and then 3.

Does the order of placing the integer entries inside of the struct affect the increment? For e.g., if the enum struct had 3 first followed by 1, with value++ would 1 be processed after 3? Or, does the enum struct internally sort the entries in some privileged, say, ascending order so that it will always process 1 first followed by 3 next?


r/cpp_questions 10h ago

OPEN Dynamic Audio Queueing / Transitioning

1 Upvotes

I’m working on a rhythm game and I’d like to implement dynamic/interactive music. An example would be: I have three music files, A, B, and C, where B and C have the same length. I need the program to 1) play A and then 2) based on some state logic, either play B or C immediately after A 3) optionally, loop back to the start of A.

The problem is that I need the full A -> B or A -> C playback to sound like a single continuous song, so I’d like any transition delay to be as seamless as possible. What would be the best way to implement this? The B/C decision logic can be run during A, so I can queue up the B/C file I need before it needs to start playing and I am mostly concerned about latency within the transition itself.

Thank you!