Skip to content

Instantly share code, notes, and snippets.

@csbuja
Last active August 29, 2015 14:12
Show Gist options
  • Save csbuja/538878bd1bf5e67d3482 to your computer and use it in GitHub Desktop.
Save csbuja/538878bd1bf5e67d3482 to your computer and use it in GitHub Desktop.
It works
#include <iostream>
#include <fstream>
using namespace std;
template<size_t n, size_t k> struct combo;
template<size_t n>
struct combo<n,0>{
const static auto value =1;
};
template<size_t n>
struct combo<n,n>{
const static auto value =1;
};
template< size_t n, size_t k>
struct combo{
const static auto value = combo<n-1,k-1>::value + combo<n-1,k>::value;
};
int main(){
cout << combo<10,5>::value;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment