- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is "Argument-Dependent Lookup" ("Koenig Lookup") in C++?
Argument-dependent lookup(ADL) is a protocol for looking up unqualified function names in function-call expressions.
These function call expressions include implicit function calls to overloaded operators.
The function names are looked up in the namespaces of their arguments in addition to the scopes and namespaces considered by the usual unqualified name lookup. Argument-dependent lookup makes it possible to use operators defined in a different namespace.
Example
namespace MyNamespace{ class A {}; void f( A &a, int i) {} } int main() { MyNamespace::A a; f( a, 0 ); //calls MyNamespace::f }
The lookup of a function call to f was dependent on the argument a. The same case is applied to arguments like << and >> that are looked up in std namespace when we use things like cout, cin, endl, etc.
- Related Articles
- C++ program to implement ASCII lookup table
- Java Program to Lookup enum by String value
- Perform $lookup to array of object id's in MongoDB?
- 8085 program for running light with delays using lookup table.
- What is a command line argument in C language?
- Argument Coercion in C/C++?
- Variable Length Argument in C
- Dependent Personality Disorder
- Get the angle whose sine is float value argument in C#
- What happens if a NULL argument is provided in MySQL CONV() function?
- What is Gordon's Bird-in-the-Hand argument of dividend?
- C function argument and return values
- How to start dependent services in PowerShell?
- What MySQL returns if the argument of QUOTE() function is NULL?
- What MySQL returns if the first argument of INTERVAL() function is NULL?

Advertisements