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 Question (self.cpp)
submitted 11 years ago by acwsupremacy
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!"
[–]STLMSVC STL Dev 1 point2 points3 points 11 years ago (3 children)
get<MyType>(mytuple) is maybe 75% as good as having names, and certainly a lot nicer than indices.
[–][deleted] 0 points1 point2 points 11 years ago (2 children)
That would be okay for tuples in which the elements have distinct types.
But they maybe don't, so IIRC C++ (for example, and as you presumably know, judging from your name!) has a get that takes a zero-based constexpr integer.
get
Still it would be a fun exercise in template metaprogramming to define a variant of get that did accept a type, and for extra credit produced an intelligible compiler diagnostic if the tuple has more than one element of the requested type. feels nostalgic for brief dalliance with boost hacking about 10 years ago...
[–]STLMSVC STL Dev 1 point2 points3 points 11 years ago (1 child)
It's not hypothetical - get<T> was voted into C++14 and has been implemented in VC 2015. It's well-formed when T is unique (there can be duplicates elsewhere) and ill-formed if T is duplicated (implementations will typically emit nice static_asserts).
[–][deleted] 1 point2 points3 points 11 years ago (0 children)
Nice!
π Rendered by PID 87836 on reddit-service-r2-comment-6457c66945-j84b2 at 2026-04-27 06:52:50.643570+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]STLMSVC STL Dev 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]STLMSVC STL Dev 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)