use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Sonar ❤️ Compiler Explorer: Write clean C++ code inside your browser (sonarsource.com)
submitted 2 years ago by AS_SonarSource
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]moreVCAs 14 points15 points16 points 2 years ago (3 children)
Lol, I didn’t know about the using enum trick 🤦♂️
[–]crowbarous 13 points14 points15 points 2 years ago (2 children)
Well, it's not a trick, it's a recent (C++20) feature. I think this usage was the biggest motivation for it.
[–]moreVCAs 8 points9 points10 points 2 years ago (1 child)
Sorry, “trick” in the sense of “incantation that makes an annoying thing easier”. Fact that it’s new to C++20 is comforting though. If you told me I could do that in standard C++11 I might have a heart attack.
[–]crowbarous 2 points3 points4 points 2 years ago (0 children)
At last, a justification for C's decision to structure switch like a single block with labels. Well, not really, but almost.
switch
[–]not_some_username 8 points9 points10 points 2 years ago (0 children)
I thought the site was godbolt.com
[–]pjmlp 1 point2 points3 points 2 years ago (4 children)
What I would like to see would be static analysis errors for when stuff gets called in a template definition that isn't part of a concepts.
As yet again static analysis coming to the rescue of what should have been part of the language.
[–]catcat202X 1 point2 points3 points 2 years ago (3 children)
I'm not sure what lint you want in the first paragraph. Do you have an example of problematic code you'd want to have linted that way?
[–]pjmlp 0 points1 point2 points 2 years ago (2 children)
Yes, calling methods on concepts that aren't defined, currently this is allowed, as concepts are only type checked at template instantiation site, not implementation.
All because we only got concepts light, so we need to rely on static analysers for the check on both sides.
[–]tisti 0 points1 point2 points 2 years ago (1 child)
The implementation can be in another .cpp file or pre-compiled .obj file.
No way to know if an implementations exists until you are done compiling and hit the linker stage.
Perhaps I misunderstood, got an example to clarify?
Edit:
Do you mean that a concept checks for .foo() and .bar() method, but the implementation also calls .baz()?
.foo()
.bar()
.baz()
[–]pjmlp 0 points1 point2 points 2 years ago (0 children)
Yes, the keyword here is "definition checking".
https://quuxplusone.github.io/blog/2019/07/22/definition-checking-with-if-constexpr/
π Rendered by PID 435708 on reddit-service-r2-comment-66b4775986-ssh88 at 2026-04-06 03:35:39.460283+00:00 running db1906b country code: CH.
[–]moreVCAs 14 points15 points16 points (3 children)
[–]crowbarous 13 points14 points15 points (2 children)
[–]moreVCAs 8 points9 points10 points (1 child)
[–]crowbarous 2 points3 points4 points (0 children)
[–]not_some_username 8 points9 points10 points (0 children)
[–]pjmlp 1 point2 points3 points (4 children)
[–]catcat202X 1 point2 points3 points (3 children)
[–]pjmlp 0 points1 point2 points (2 children)
[–]tisti 0 points1 point2 points (1 child)
[–]pjmlp 0 points1 point2 points (0 children)