What functions are found

suggest change

Functions are found by first collecting a set of “associated classes” and “associated namespaces” that include one ore more of the following, depending on the argument type T. First, let us show the rules for classes, enumeration and class template specialization names.

Now there are a few rules for builtin types as well

All functions and templates within all associated namespaces are found by argument dependent lookup. In addition, namespace-scope friend functions declared in associated classes are found, which are normally not visible. Using directives are ignored, however.

All of the following example calls are valid, without qualifying f by the namespace name in the call.

namespace A {
   struct Z { };
   namespace I { void g(Z); }
   using namespace I;

   struct X { struct Y { }; friend void f(Y) { } };
   void f(X p) { }
   void f(std::shared_ptr<X> p) { }
}

// example calls
f(A::X());
f(A::X::Y());
f(std::make_shared<A::X>());

g(A::Z()); // invalid: "using namespace I;" is ignored!

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Argument dependent name lookup:
* What functions are found

Table Of Contents
8 Arrays
11 Loops
39 Streams
51 Unions
56 Lambdas
60 SFINAE
62 RAII
67 Sorting
84 RTTI
87 Scopes
101 Argument dependent name lookup
104 Profiling
107 Recursion
117 Iteration
125 Alignment
134 Semaphore
136 Debugging
139 Mutexes
142 decltype