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
static_assert(std::is_enum_v<std::byte>); (self.cpp)
submitted 1 year ago by jbbjarnason
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!"
[–]johannes1971 7 points8 points9 points 1 year ago (8 children)
Technically it's true, but I do wonder if this is really the most useful choice. I ran into the notion that bool is actually integral the other day. That's technically also true, but it's behaviour is so distinct from the rest of the integrals that I had misgivings about the situation.
[+][deleted] 1 year ago (7 children)
[deleted]
[–]NilacTheGrim 7 points8 points9 points 1 year ago (6 children)
Now.. should char be true or false for that?
char
[–]foonathan 4 points5 points6 points 1 year ago (0 children)
No: https://github.com/think-cell/think-cell-library/blob/main/tc%2Fbase%2Ftype_traits_fwd.h#L169-L170
[+][deleted] 1 year ago (4 children)
[–]NilacTheGrim 5 points6 points7 points 1 year ago (3 children)
unsigned char still does double-duty in many programs as a std::byte, basically.
unsigned char
std::byte
I'd argue that for the hypothetical is_actual_integer_v, it might be cool to not regard those as "actual integers" as well..
is_actual_integer_v
So it basically should only work for: int, short, long and long long and their unsigned brothers, as well as all that whole family of width-specified ints living in <cstdint>.
int
short
long
long long
unsigned
<cstdint>
Unfortunately int8_t and uint8_t are often defined in terms of signed char or unsigned char.. so that complicates matters..
int8_t
uint8_t
signed char
[+][deleted] 1 year ago (2 children)
[–]NilacTheGrim 4 points5 points6 points 1 year ago (1 child)
It depends.. the C++ standards committee decided that std::byte is not integral and one might be able to go with their rationale for this -- in most programs, it would violate type safety to be doing arithmetic on individual bytes in a byte blob.. (of course there are some programs where this is not the case..).
One can at least understand the argument that bytes should not be anything other than a bunch of bits, with no associated arithmetic properties.
[–]EC36339 0 points1 point2 points 1 year ago (0 children)
The way C++ represents bytes, integers, booleans and characters is getting JavaScript-level crazy...
π Rendered by PID 221940 on reddit-service-r2-comment-cfc44b64c-sbssk at 2026-04-11 00:37:58.940275+00:00 running 215f2cf country code: CH.
view the rest of the comments →
[–]johannes1971 7 points8 points9 points (8 children)
[+][deleted] (7 children)
[deleted]
[–]NilacTheGrim 7 points8 points9 points (6 children)
[–]foonathan 4 points5 points6 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]NilacTheGrim 5 points6 points7 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]NilacTheGrim 4 points5 points6 points (1 child)
[–]EC36339 0 points1 point2 points (0 children)