devxlogo

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.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Five Early Architecture Decisions That Quietly Get Expensive

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.