인수 종속성(Koenig) 조회 지원
업데이트: 2007년 11월
Visual C++ 컴파일러에서는 이제 Koenig 조회가 완전히 구현됩니다.
자세한 내용은 Argument Dependent Name (AKA Koenig) Lookup on Functions를 참조하십시오.
예제
다음 샘플은 Visual Studio .NET에서 런타임에 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