c_-_c_templates:namespace_and_template
C - C++ Templates - Namespace and template
#include <iostream> namespace X { template<typename T> void f(T); } namespace N { using namespace X; enum E { e1 }; void f(E) { std::cout << "N::f(N::E) called\n"; } } void f(int) { std::cout << "::f(int) called\n"; } int main() { ::f(N::e1); // qualified function name: no ADL f(N::e1); // ordinary lookup finds ::f() and ADL finds N::f(), the latter is preferred.
c_-_c_templates/namespace_and_template.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1