Skip to content

Instantly share code, notes, and snippets.

@HappyCerberus
Created September 9, 2015 14:37
Show Gist options
  • Save HappyCerberus/16d191c9bb8cfee9f0e4 to your computer and use it in GitHub Desktop.
Save HappyCerberus/16d191c9bb8cfee9f0e4 to your computer and use it in GitHub Desktop.
#include <cmath>
#include <iostream>
using namespace std;
template <int value> struct Test { int test() { return value; } };
template <> struct Test<0> { int test() { return 0; } };
int main()
{
Test<static_cast<int>(floor(0.5))> a;
cout << a.test() << endl;
Test<static_cast<int>(log(22))> b;
cout << b.test() << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment