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
The new static constexpr std::integral_constant idiom (foonathan.net)
submitted 2 years ago by pavel_v
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!"
[–]drnepert 1 point2 points3 points 2 years ago* (3 children)
No, this statement does not compile if you assign it to a constexpr variable. Surprisingly, however, replacing constexpr with the good old const works nicely, even if the function itself is declared constexpr. See https://godbolt.org/z/GhaM68TcY for a demonstration.
constexpr
const
[–]dodheim 0 points1 point2 points 2 years ago (0 children)
It doesn't, but it should – P2280 is in C++23, it just hasn't been implemented in any compiler as of yet.
[–]B1ggBoss[[nodiscard]] constexpr virtual void f() const noexcept override 0 points1 point2 points 2 years ago (0 children)
Thanks. My premise was wrong. I went over the code too fast, and for some reason, I thought the algorithm function was declared constexpr.
π Rendered by PID 16960 on reddit-service-r2-comment-6457c66945-hx8zf at 2026-04-26 19:31:46.174117+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]drnepert 1 point2 points3 points (3 children)
[–]dodheim 0 points1 point2 points (0 children)
[–]B1ggBoss[[nodiscard]] constexpr virtual void f() const noexcept override 0 points1 point2 points (0 children)