Skip to content

Instantly share code, notes, and snippets.

@ALSchwalm
Created April 12, 2013 15:46
Show Gist options
  • Save ALSchwalm/5372999 to your computer and use it in GitHub Desktop.
Save ALSchwalm/5372999 to your computer and use it in GitHub Desktop.
num test_enum
{
A,
B,
C
};
template<test_enum T>
int f(int x);
template<test_enum T>
int f(int x, int y);
template<>
int f<C>(int x)
{
return x+2;
};
template<>
int f<B>(int x, int y)
{
return x+y;
};
int main()
{
int temp = f<B>(1, 2); //temp=3
return f<C>(1); //returns 3
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment