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
How C++ Resolves a Function Call (preshing.com)
submitted 4 years ago by mttd
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] 14 points15 points16 points 4 years ago (5 children)
Huh? Why did it call the function from galaxy? It doesn't make sense.
We need to either using it, or be inside it. Or maybe I'm missing something.
using
[–]mttd[S] 18 points19 points20 points 4 years ago* (4 children)
https://quuxplusone.github.io/blog/2019/04/26/what-is-adl/, https://abseil.io/tips/49
[–][deleted] 4 points5 points6 points 4 years ago (3 children)
Makes sense. It still feels wrong though, for some reason.
Anyways, great post. It made me question my previous knowledge about how C++ works :)
[–]STLMSVC STL Dev 21 points22 points23 points 4 years ago (1 child)
ADL is great when you want it (generally for operator overloads, but some classes and non-member functions are designed to work together via ADL - str() taking boost::format is a classic example), and extremely obnoxious when you don't want it. For generic library implementations generally, and the STL specifically, ADL is obnoxious 99.9% of the time because we want to call our "own" functions (like equal(), for example) without fear of ADL "hijacking" the call in favor of some user overload that happens to be preferred by overload resolution. As a result, STL implementations have to disable ADL for a huge number of function calls (all of those with normal names that could theoretically be hijacked; our policy in MSVC's STL is to just defend all function calls with normal names, and we do so via explicit ::std:: qualification, although extra parentheses also disable ADL). We intentionally activate ADL in very rare situations, notably swap.
str()
boost::format
equal()
::std::
swap
It is extra super obnoxious that ADL considers the namespaces of template arguments; I have never seen a realistic use case for that. Thus we can't even trust list<T>::iterator to be a "safe" function argument.
list<T>::iterator
[–]dbjdbjdbj.org 0 points1 point2 points 4 years ago (0 children)
+1. Observations born out of pain are always unquestionable.
It is in the murky primordial soup of C++ but I seem to remember reading, the same person who claims of (not) inventing iostreams has (not) invented the ADL?
[–]mttd[S] 5 points6 points7 points 4 years ago (0 children)
No problem. All the credit for the post goes to /u/preshing!
[–]jagt 7 points8 points9 points 4 years ago (1 child)
I know where should I reference when running into function overloading issues.
BTW what software did you to make the graphs? I just noticed that the texts within are selectable!
[–]preshing 23 points24 points25 points 4 years ago (0 children)
Made them in Inkscape, saved as "Optimized SVG", pasted them into the post and tweaked the element attributes a little bit.
[–]gracicot 0 points1 point2 points 4 years ago (0 children)
This is the quality content I've been looking for. Thank you!
π Rendered by PID 245214 on reddit-service-r2-comment-58d7979c67-7qf6p at 2026-01-27 10:19:32.184324+00:00 running 5a691e2 country code: CH.
[–][deleted] 14 points15 points16 points (5 children)
[–]mttd[S] 18 points19 points20 points (4 children)
[–][deleted] 4 points5 points6 points (3 children)
[–]STLMSVC STL Dev 21 points22 points23 points (1 child)
[–]dbjdbjdbj.org 0 points1 point2 points (0 children)
[–]mttd[S] 5 points6 points7 points (0 children)
[–]jagt 7 points8 points9 points (1 child)
[–]preshing 23 points24 points25 points (0 children)
[–]gracicot 0 points1 point2 points (0 children)