I'm trying to understand Argument Dependent Lookup. The classic example is:
namespace NS {
class T { };
void f(T);
}
NS::T parm;
int main() {
f(parm); // OK: calls NS::f
}
I'm looking at this page and in particular this statement:
If T is a class type, its associated classes are the class itself and its direct and indirect base classes. Its associated namespaces are the namespaces in which its associated classes are defined.
And I'm trying to understand why this code does not compile:
class NS {
public:
class T {
public:
void f(T)
{
std::cout << "there" << std::endl;
}
};
void f(T)
{
std::cout << "here" << std::endl;
}
};
NS::T parm;
int main() {
f(parm); // OK: calls NS::f
return 0;
}
One of the two f's should be found but neither one is found. Can someone help me understand why?
Thank you for your help,
Perry