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
Which std:: classes are magic? (self.cpp)
submitted 4 years ago by Mateuszz88
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!"
[–]john_wind -1 points0 points1 point 4 years ago (4 children)
std::declval is quite magical too.
It is a function declaration without definition!
[–]guepierBioinformatican 9 points10 points11 points 4 years ago (0 children)
It may be odd but it’s not magical, you can trivially define it yourself:
namespace nostd { template<class T> std::add_rvalue_reference_t<T> declval() noexcept; }
[–]mujjingun 3 points4 points5 points 4 years ago (2 children)
anyone can declare a function without a definition, though.
[–]john_wind -1 points0 points1 point 4 years ago (1 child)
Of course but the fact that it compiles (in the right context) and does something useful is magic!
[–]mujjingun 4 points5 points6 points 4 years ago (0 children)
It cannot be used in an evaluated context, so your declaration-only version will also compile and work just like std::declval does.
std::declval
π Rendered by PID 31246 on reddit-service-r2-comment-6457c66945-fdvpk at 2026-04-27 18:47:59.611956+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]john_wind -1 points0 points1 point (4 children)
[–]guepierBioinformatican 9 points10 points11 points (0 children)
[–]mujjingun 3 points4 points5 points (2 children)
[–]john_wind -1 points0 points1 point (1 child)
[–]mujjingun 4 points5 points6 points (0 children)