如果我需要一种满足std::is_unsigned和std::is_integral,我必须同时检查或只std::is_unsigned?
考虑http://en.cppreference.com/w/cpp/language/adl中描述的此示例:
namespace A {
struct X;
struct Y;
void f(int);
void g(X);
}
namespace B {
void f(int i) {
f(i); // calls B::f (endless recursion)
}
void g(A::X x) {
g(x); // Error: ambiguous between B::g (ordinary lookup)
// and A::g (argument-dependent lookup)
}
void h(A::Y y) {
h(y); // calls B::h (endless recursion): ADL examines the A namespace
// but finds no A::h, so only B::h from ordinary lookup is used
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道为什么出现歧义,因为如果不考虑ADL规则
"由通常的非限定查找生成的查找集包含以下任何内容".
这里B …