A deep dive into C++ name lookup mechanisms, focusing on Argument-Dependent Lookup (ADL), also known as Koenig lookup. Covers unqualified and qualified name lookup rules, how ADL extends unqualified lookup through argument namespaces, the hidden friend pattern, and why adding functions to the std namespace causes undefined behavior. Uses a real-world OpenCV code issue as a case study to demonstrate how to correctly place functions so they remain discoverable via ADL without violating the C++ standard.
Sort: