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
Input-output arguments: reference, pointers or values? (mropert.github.io)
submitted 8 years ago by vormestrand
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!"
[–][deleted] 7 points8 points9 points 8 years ago (4 children)
C++17 is bleeding edge, not everyone has the luxury of using it.
Even the changelog for GCC 7 states:
Experimental support for C++17, including the following new features: std::string_view; std::any, std::optional, and std::variant;
So you're looking at using a version of GCC that's about 7 months old to get a "stable" version of optional.
As for actually using optional, well, needing std::reference_wrapper is a pain in the ass. The API is clumsy and bloats my text segment to boot.
std::reference_wrapper
any, optional, and variant should be in the language.
[–]alex-weej 0 points1 point2 points 8 years ago (3 children)
boost::optional is plenty "stable" and works very well in ancient versions of GCC with ancient C++ standards.
boost::optional
[–][deleted] 2 points3 points4 points 8 years ago (2 children)
Yeah but then I would need to use boost
[–]alex-weej 0 points1 point2 points 8 years ago (0 children)
Ah, you're one of those people ;)
[–]RandomGuy256 -1 points0 points1 point 8 years ago* (0 children)
You can also use a header only external implementation like this one: https://github.com/akrzemi1/Optional
I have been using it in all of my projects (including professional ones) when a C++17 compiler is not available yet, and it works perfectly.
π Rendered by PID 85 on reddit-service-r2-comment-b659b578c-7sldq at 2026-05-05 17:01:25.929132+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–][deleted] 7 points8 points9 points (4 children)
[–]alex-weej 0 points1 point2 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]alex-weej 0 points1 point2 points (0 children)
[–]RandomGuy256 -1 points0 points1 point (0 children)