Item 25. Argument Dependent Lookup

Namespaces have a pervasive influence on modern C++ programs and designs (see Namespaces [23, 81]). Some of these influences are immediately obvious, such as the presence of using declarations and directives and qualification of names with namespace scope. However, namespaces have less syntactically obvious influences that are nevertheless as basic and important. Argument dependent lookup (ADL) is one of these. Like many C++ features, ADL has the potential to be complex, but in common use it is straightforward and solves many more problems than it introduces.

The idea behind ADL is simple. When looking up the name of a function in a function call expression, the compiler will also examine namespaces that contain ...

Get C++ Common Knowledge: Essential Intermediate Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.