Possible Duplicate:
Why doesn't ADL find function templates?
Calling get does not seem to invoke argument dependent lookup:
auto t = std::make_tuple(false, false, true);
bool a = get<0>(t); // error
bool b = std::get<0>(t); // okay
g++ 4.6.0 says:
error: 'get' was not declared in this scope
Visual Studio 2010 says:
error C2065: 'get': undeclared identifier
Why?
It’s because you attempt to explicitly instantiate
getfunction template, by providing0as template argument. In case of templates, ADL works if a function template with that name is visible at the point of the call. This visible function template only helps triggering ADL (it may not be used actually) and then, a best matching can be found in other namespaces.Note that the function template which triggers (or enable) ADL, need not to have definition:
In
g(), the nameN::gettriggers ADL when callingget<0>(s).Demo : http://ideone.com/83WOW
C++ (2003) section §14.8.1/6 reads,