Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
The Visual C++ compiler does not currently support binding nondependent names when initially parsing a template. This can cause overloads to be declared after the template (but before the template is instantiated) to be seen.
// DependentNames.cpp
#include <stdio.h>
namespace N {
void f(int) { printf("f(int)\n");}
}
template <class T> void g(T) {
N::f('a'); // calls f(char) should call f(int)
}
namespace N {
void f(char) { printf_s("f(char)\n");}
}
int main() {
g('c');
}
Output
f(char)