Koenig Lookup

Koenig Lookup

Andrew Koenig devised an algorithm for resolving namespace members’ lookup. This algorithm is used in all standard-conforming compilers to handle cases like the following:

  namespace MINE {  class C {};  void func(C);  } MINE::C c; // global object of type MINE::Cvoid main() {  func( c ); // OK, MINE::f called }

No using declaration or using directive exists in the program. Still, the compiler did the right thing by applying Koenig lookup. Koenig lookup instructs the compiler to look not just in the usual places such as the local scope, but also the namespace that contains the argument’s type.

See also  How HealthStream Learning Center Supports Healthcare Education and Compliance

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist