ADL(argument-dependent lookup):依赖于参数的查找
#include<iostream>
using namespace std;
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);//受限函数名称:不会使用ADL
f(N::e1);//普通查找将找到f();ADl将找到N::f()
}
::f(int) called
N::f(N::E) called