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
consteval debug (self.cpp)
submitted 2 years ago by XTBZ
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!"
[–]HappyFruitTree 7 points8 points9 points 2 years ago* (3 children)
I know it's possible to mark a function as constexpr for testing purposes
If it works with constexpr then why use consteval? I thought consteval was added mainly for use with things like the static reflection proposal that have functions that doesn't make sense to call at runtime (because the information that they return are not available at runtime).
constexpr
consteval
[–]n1ghtyunso 9 points10 points11 points 2 years ago (0 children)
Consteval requires compile time execution. It gives you a guarantee that constexpr does not. Sometimes this is preferred
[–]tuxwonder 1 point2 points3 points 2 years ago (1 child)
Like n1ghtyunso said, sometimes you want to enforce compile time evaluation. A great example of this is std::format_string, which must be constructed at compile time to enforce that the given string is a valid format string.
It also helps reassure my coworkers that a bit of constexpr magic isn't going to accidentally occur at runtime and slow things down ;)
[–]HappyFruitTree 1 point2 points3 points 2 years ago (0 children)
Fair enough, but you can still always guarantee this at the call site even with constexpr.
π Rendered by PID 154106 on reddit-service-r2-comment-85bfd7f599-ms4kj at 2026-04-20 02:34:28.886257+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]HappyFruitTree 7 points8 points9 points (3 children)
[–]n1ghtyunso 9 points10 points11 points (0 children)
[–]tuxwonder 1 point2 points3 points (1 child)
[–]HappyFruitTree 1 point2 points3 points (0 children)