Skip to content

Instantly share code, notes, and snippets.

@dgodfrey206
Last active August 29, 2015 14:14
Show Gist options
  • Save dgodfrey206/430779cfe01004d7c50c to your computer and use it in GitHub Desktop.
Save dgodfrey206/430779cfe01004d7c50c to your computer and use it in GitHub Desktop.
ADL and function template instantiation
template<class T>
decltype(f(T())) h() {}
void f(int);
void f(struct X);
struct X {};
int main()
{
h<int>(); // fundamental types have no associated namespaces
h<X>(); // user-defined types have associated global namespace
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment