Argumentabhängige Suche (Koenig-Suche) wird jetzt unterstützt
Aktualisiert: November 2007
Die Koenig-Suche ist jetzt vollständig im Visual C++-Compiler implementiert.
Weitere Informationen finden Sie unter Argument-Dependent Name (Koenig) Lookup on Functions.
Beispiel
Der folgende Beispielcode verhält sich zur Laufzeit in Visual Studio .NET anders als in Visual Studio .NET 2003.
// bc_argument_dependent_AKA_Koenig_lookup_now_supported.cpp
// compile with: /W1
#include <stdio.h>
namespace N {
class X {};
void f(X *pX) {
printf_s("in N::X::f\n");
}; // called if compiled with 7.1
}
void f(void *pv) {
printf_s("in ::f\n");
}; // called if compiled with 7.0
int main() {
N::X *pX = 0;
f(pX);
// The following lines will result in the same behavior
// in Visual Studio .NET or Visual Studio .NET 2003
f((void*)pX); // Cast pX to void before calling f; calls global f
::f(pX); // Explicitly specify global f
N::f(pX); // Explicitly specify f in namespace
}
in N::X::f
in ::f
in ::f
in N::X::f