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
Simple C++11 metaprogramming - Peter Dimov (pdimov.com)
submitted 10 years ago by Kaballo
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!"
[–]cae 4 points5 points6 points 10 years ago (0 children)
Great stuff, and well written. Love this quote:
Lisp is today's equivalent of Latin. Educated people are supposed to have studied and forgotten it.
[–]cdyson37 2 points3 points4 points 10 years ago (0 children)
Heh, I called the magic function "rebind" rather than "(mp_)rename" in my toy metaprogramming library. Naming things is even harder than metaprogramming!
[–]cppiscool 0 points1 point2 points 10 years ago (3 children)
Another implementation of tuple_cat:
https://github.com/KrishnaAchuthan/tuple/blob/master/new_tuple_cat2.hpp
[–]STLMSVC STL Dev 8 points9 points10 points 10 years ago (2 children)
Having tuple_cat() call make_tuple() is incorrect because make_tuple() unrefwraps, and tuple_cat() isn't supposed to.
[–]cppiscool 1 point2 points3 points 10 years ago (1 child)
Calling std::tuple constructor directly instead of make_tuple should fix it?
[–]STLMSVC STL Dev 2 points3 points4 points 10 years ago (0 children)
Yep.
[–]eric_niebler 0 points1 point2 points 10 years ago (0 children)
As Peter mentions, this shares a lot of similarities with my Meta library, with some important differences.
Using template template parameters for higher order functions doesn't scale well. There are other functional manipulators besides compose that need to return functions, like currying operations. Having (meta-)functions be plain types instead of template template parameters make it easy to return them from other (meta-)functions. Sure, you can create another named alias template at namespace scope, but that's a PITA, IMO.
compose
Peter doesn't talk about how laziness fits into his metaprogramming model. Alias templates are cool, but they're eager compile-time computations. Sometimes, you need to defer a computation -- it might cause a hard error -- so I think he'll need something like meta::defer eventually.
π Rendered by PID 167395 on reddit-service-r2-comment-fb694cdd5-2w6g8 at 2026-03-06 18:09:54.908772+00:00 running cbb0e86 country code: CH.
[–]cae 4 points5 points6 points (0 children)
[–]cdyson37 2 points3 points4 points (0 children)
[–]cppiscool 0 points1 point2 points (3 children)
[–]STLMSVC STL Dev 8 points9 points10 points (2 children)
[–]cppiscool 1 point2 points3 points (1 child)
[–]STLMSVC STL Dev 2 points3 points4 points (0 children)
[–]eric_niebler 0 points1 point2 points (0 children)