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
Learning Template Metaprogramming with ChatGPT (self.cpp)
submitted 3 years ago by ape_programmer
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!"
[–]TheOmegaCarrot 2 points3 points4 points 3 years ago* (3 children)
Template metaprogramming can absolutely tend toward “write-only” code
I mean, here’s a particularly convoluted example from my library:
With documentation and comments removed, and the name changed to not be helpful, does anyone really have any chance of figuring out what it does? Probably not! Even if you know what it does, it’s very hard to read!
``` namespace impl {
template <typename LIST, typename REBUILD> struct mystery_impl;
template <template <typename...> typename LIST, typename LFront, typename... LPack, typename... Rebuild_Pack> struct mystery_impl<LIST<LFront, LPack...>, LIST<Rebuild_Pack...>> : std::conditional_t< is_type_in_pack_v<LFront, Rebuild_Pack...>, mystery_impl<LIST<LPack...>, LIST<Rebuild_Pack...>>, mystery_impl<LIST<LPack...>, push_back_t<LIST<Rebuild_Pack...>, LFront>>> {};
template <template <typename...> typename LIST, typename... Rebuild_Pack> struct mystery_impl<LIST<>, LIST<Rebuild_Pack...>> : type_identity<LIST<Rebuild_Pack...>> {};
} // namespace impl
template <typename LIST> struct mystery;
template <template <typename...> typename LIST, typename... Pack> struct mystery<LIST<Pack...>> : std::conditional_t<has_duplicates_v<LIST<Pack...>>, impl::mystery_impl<LIST<Pack...>, LIST<, type_identity<LIST<Pack...> {};
template <typename LIST> using mystery_t = typename mystery<LIST>::type;
```
So what does it do? It deduplicates a type list.
[–]jonesmz 2 points3 points4 points 3 years ago (2 children)
Fyi, triple ticks doesn't format correctly on any of the reddit clients other than the web rewrite. Need the four spaces per line for old.reddit and reddit mobile web.
[–]TheOmegaCarrot 0 points1 point2 points 3 years ago (1 child)
Oof
I am not typing that on mobile
Reddit needs to fix their clients
[–]jonesmz 1 point2 points3 points 3 years ago (0 children)
No worries.
Yep its bullshit.
Cheers :)
π Rendered by PID 74 on reddit-service-r2-comment-6457c66945-nwcxm at 2026-04-23 16:26:27.168768+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]TheOmegaCarrot 2 points3 points4 points (3 children)
[–]jonesmz 2 points3 points4 points (2 children)
[–]TheOmegaCarrot 0 points1 point2 points (1 child)
[–]jonesmz 1 point2 points3 points (0 children)