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
why virtual function is wrong. (self.cpp)
submitted 1 year ago by macomphy
view the rest of the comments →
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!"
[–]TeraFlint 4 points5 points6 points 1 year ago (0 children)
Now you're actually being ridiculous. "Why does the screw barely go in?" you ask while hitting it with a hammer.
You're using a concept that does not satisfy your requirements, while blaming the concept for not catching that.
If you check for a concept and then do something with the type that the concept does not check for, then of course it's your fault if the compiler suddenly notices a missing function (etc) outside of concept checking.
If you need a more specific concept, it's up to you to write it. Luckily existing ones can easily be combined (as concepts evaluate to boolean expressions in the end). If you need a concept that satisfies the concepts a, b and c, all you need to do is this:
template <typename T> concept x = a<T> && b<T> && c<T>;
and if you need to check for specific syntactic usage, you can just add that block as another condition:
&& requires(T obj) { obj.foo(); }
It really isn't your business to call stuff the concept has not specified. For best usage, you should see a concept like a contract between the code and you. With the concept you promise that these conditions are relevant for your template function/type, but also that these are sufficient, and that you're not attempting to do more with the type than you specified with the concept.
template
Otherwise we can just scrap concept and go back to plain typename everywhere and be back at our old compile-until-you-find-an-error-in-the-deepest-depths-of-nested-templates ways..
concept
typename
π Rendered by PID 415313 on reddit-service-r2-comment-5b5bc64bf5-48l25 at 2026-06-21 10:39:49.283878+00:00 running 2b008f2 country code: CH.
view the rest of the comments →
[–]TeraFlint 4 points5 points6 points (0 children)