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

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

Feedback about page:

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

Table Of Contents