Go to the documentation of this file.00001
00010 #ifndef BINOMIAL_HH
00011 #define BINOMIAL_HH
00012
00013
00014 namespace mask{
00015
00025 template<unsigned int N, unsigned int K>
00026 struct Binomial{
00027 static const unsigned int val = Binomial<N-1,K>::val + Binomial<N-1,K-1>::val;
00028 };
00029
00031 template<unsigned int N>
00032 struct Binomial<N,0>{
00033 static const unsigned int val = 1;
00034 };
00035
00037 template<unsigned int K>
00038 struct Binomial<0,K>{
00039 static const unsigned int val = 0;
00040 };
00041
00047 template<>
00048 struct Binomial<0,0>{
00049 static const unsigned int val = 1;
00050 };
00051
00052
00053 }
00054
00055 #endif //BINOMIAL_HH