name-resolution

List of C++ name resolution (and overloading) rules

醉酒当歌 提交于 2019-11-27 11:27:09
Where I can find a list of the rules that a C++ compliant compiler must apply in order to perform names resolution (including overloading)? I'd like something like a natural-language algorithm or flow chart. C++ standard of course has this set of rules but it is build up as new language statements are introduced and the result it's pretty hard to remember. To make a long story short, I'd like to know the complete and detailed answer to the question " What compiler do when it see the name 'A' ?" I know C++ is all " We do this when X but not Y if Z holds " so, I'm asking whether it is possible

Dependent name resolution & namespace std / Standard Library

谁都会走 提交于 2019-11-27 09:31:00
While answering this SO question (better read this "duplicate" ), I came up with the following solution to dependent name resolution of an operator: [temp.dep.res]/1: In resolving dependent names, names from the following sources are considered: Declarations that are visible at the point of definition of the template. Declarations from namespaces associated with the types of the function arguments both from the instantiation context (14.6.4.1) and from the definition context. #include <iostream> #include <utility> // this operator should be called from inside `istream_iterator` std::istream&