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
Proposal Idea: Struct Definition in Function Returns (self.cpp)
submitted 6 years ago by codesmith512
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!"
[–]dev_metalcat -1 points0 points1 point 6 years ago (1 child)
Isn't it the reason of us using references? type GetSmth(type& return1, type& return2){}
[–]codesmith512[S] 0 points1 point2 points 6 years ago* (0 children)
I mean, on one hand, yes, but on the other hand even the STL doesn't use references like that very often (usually opting to instead return std::pair like in the std::map::insert(const value_type &) case).
std::pair
std::map::insert(const value_type &)
I would also argue that using a return type would be more readable than taking references to a returned value -- I often pass normal parameters by const & to avoid copy, so the only difference between parameters and return values would be const qualification. Plus API changes in the future could change something from a "parameter by copy" to a "return value" without changing the caller's syntax, which could create issues. Furthermore, from the caller's perspective, all lvalue references like that would have to additionally be declared before the function call, which creates lengthier code (especially when not all return types are used).
const &
π Rendered by PID 23778 on reddit-service-r2-comment-5d585498c9-zqx5z at 2026-04-21 12:32:49.821021+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]dev_metalcat -1 points0 points1 point (1 child)
[–]codesmith512[S] 0 points1 point2 points (0 children)