Skip to content

Instantly share code, notes, and snippets.

@andrey-malets
Created August 11, 2015 15:50
Show Gist options
  • Select an option

  • Save andrey-malets/40a6406baf2bf7d8a93b to your computer and use it in GitHub Desktop.

Select an option

Save andrey-malets/40a6406baf2bf7d8a93b to your computer and use it in GitHub Desktop.
template<typename> struct T {
};
template<> struct T<int> {
static const int value = 1;
};
template<> struct T<float> {
static const int value = 2;
};
template<template<typename> class T> int f() {
return T<int>::value;
}
template<> int f<T>() {
return T<float>::value;
}
int main(void) {
return f<T>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment