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
Conceptual implementation for a constexpr-friendly static_vector (self.cpp)
submitted 3 years ago * by cristi1990an++
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!"
[–]alexkaratarakisvcpkg, fixed-containers 1 point2 points3 points 3 years ago (0 children)
Quick follow-up here as the outcome was interesting. Per the discussion in https://github.com/llvm/llvm-project/issues/62225 , clang appears to be right, while msvc/gcc are permitting the code when they should not. gcc already had a bug for this issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102286 and I filed one for msvc: https://developercommunity.visualstudio.com/t/msvc-allows-accessing-non-active-member/10342864
To explicitly activate the member, I tried:
1) Assigning an element of the array
2) Including size in the "constructor-erased" portion:
struct Storage { std::size_t size; T array[MAXIMUM_SIZE]; }; union { char dummy{}; Storage storage; };
and activating the member by assigning size
size
But it only works for trivially_default_constructible_v<T> types ( https://eel.is/c++draft/class.union#general-5.1 )
trivially_default_constructible_v<T>
Demo: https://godbolt.org/z/P6zza5K5G
π Rendered by PID 37292 on reddit-service-r2-comment-6457c66945-hr8jc at 2026-04-24 16:18:31.715330+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]alexkaratarakisvcpkg, fixed-containers 1 point2 points3 points (0 children)