On my machine, g(99.9); calls f(float). It seems that the compiler is looking through the whole translation unit for an appropriate f(). I thought dependent names were bound at the point of instantiation though, which in this case would be just before the start of main().Code:#include <iostream> using namespace std; void f(const char*) { cout << "f(const char*)\n"; } template <class T> void g(T a){f(a);} int main() { g(99.9); g("hello"); return 0; } void f(float) { cout << "f(float)\n"; }
What is the significance of the instantiation point if names found after the instantiation point are too available for binding?



LinkBack URL
About LinkBacks



